COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 08-14-2019, 08:54 AM   #1
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default Any way to run computations outside the audio thread in WDL-OL?

I want to add a spectrum graph to my plugins and would prefer to process the FFT outside the audio thread.

Is there any way to run code outside the audio processing block in WDL-OL? I have tried placing code inside "On Idle()" but DAWs ignored it (did nothing).

Any other suggestions?

Last edited by Nonlinear; 08-14-2019 at 09:25 AM.
Nonlinear is offline   Reply With Quote
Old 08-14-2019, 10:20 AM   #2
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

You would likely need to launch and manage your own thread. The latter part is likely going to be difficult. If there's any way for you to avoid using an additional thread, that is the best.

You could try doing the calculation in the GUI thread with a timer, but at least back in IPlug1 there was no convenient way to add a custom timer. The plugin OnIdle etc stuff is not to be trusted, the hosts may or may not call those methods. If they do, they may not do so often enough or they do it too often etc...
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote
Old 08-19-2019, 01:37 PM   #3
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 623
Default

I'll be implementing a spectrum analyzer probably this week. If you are not picky about your attack and release settings being super accurate, you should be able to do the heavy lifting in the graphics thread.
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote
Old 08-20-2019, 10:39 AM   #4
Nonlinear
Human being with feelings
 
Join Date: Apr 2018
Posts: 396
Default

Quote:
Originally Posted by bozmillar View Post
I'll be implementing a spectrum analyzer probably this week. If you are not picky about your attack and release settings being super accurate, you should be able to do the heavy lifting in the graphics thread.
Please let me know how it works out! Besides running the FFT itself you then have to sweep through all the "bins" to calculate magnitude - apply an envelope detector of some sort to all of them (512+ IIR filters?) - and then plot this with an interpolated curve.

Seems pretty CPU intensive to me.
Nonlinear is offline   Reply With Quote
Old 08-20-2019, 11:05 AM   #5
bozmillar
Human being with feelings
 
bozmillar's Avatar
 
Join Date: Sep 2009
Posts: 623
Default

Quote:
Originally Posted by Nonlinear View Post
Seems pretty CPU intensive to me.
It's not that bad because you are running these calculations per window, not per sample. If your window size is 1024, you aren't running 1024 envelopes processes per sample.

If you aren't worried about the time constants being tight, you run your envelopes in the GUI thread. You can always run your interpolation in the GUI thread.

If you want your time constants correct, you can set it up like this:

Audio thread: FFT->magnitued->envelope

GUI thread: interpolation/smoothing.
__________________
http://www.bozdigitallabs.com
bozmillar is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 12:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.