computeOutputData
This function is called when it's time to update output parameters and strings.
- // prepare output data
- if (isCompressing) {
- outputParameters[0] = gainReduction;
- } else {
- outputParameters[0] = 0;
- }
- }
How often is it called?
As often as processBlock, but limited by "Output data refresh rate" (Menu -> Global Settings").
Additional explanation
In DSP you can write to outputParameters array (and outputStrings as well) anytime, in any function (in processBlock, or in updateInputParameters, etc). But these output values will be updated (posted to DAW/GUI) only once in a while, and that's when computeOutputData is called.
Output params can be updated as often as once per block, or less, depending on that "Output data refresh rate" setting. Say we have a block size of 2048 samples and sampleRate is 48000. This way we get 23-24 calls per second to processBlock, and computeOutputData is called as often.
But if you set a smaller buffer size, say 128 samples, and you get 375 calls per second to processBlock, you'll still get no more than 50 calls per second to computeOutputData because of that setting ("Output data refresh rate").
This is done to lower CPU usage, cause usually we don't need that much GUI refreshes per second.
As already said, you can totally omit this function, and update your outputParameters inside processBlock or other function, they will still be updated in the GUI. But by doing so you'll lose some CPU, because you'll probably write to your output parameters array too often without any effect.
Another note
User can change "Output data refresh rate" from 1 to 200 Hz (even more by editing "global.pref" in "~Users\..\AppData\Roaming\{Manufacturer}\{PluginName}\". By default for exported plugins this value is 50 Hz.
Also keep in mind, that when you update outputParameter in DSP, it's not immediately updated in the GUI, it takes some time to travel (because DSP and GUI access parameters data asynchronously). As said, it depends on ASIO buffer size, "Output data refresh rate" value, and also on GUI SKIN "refresh_time_ms" and "refresh_priority" attributes.