PLUG'N SCRIPT
rapid plugin development
Tutorial
DSP
KUIML
How-to
Scripts
Main functions
  • processBlock
  • processSample
  • updateInputParameters
  • updateInputParametersForBlock
  • computeOutputData
Additional
  • initialize
  • shutdown
  • reset
  • getTailSize
  • getLatency
  • wantSilence
DSPcomputeOutputData
August 04, 2020

computeOutputData

This function is called when it is time to update output parameters and strings.

  1. // Prepare output data
  2. void computeOutputData() {
  3. if (isCompressing) {
  4. outputParameters[0] = gainReduction;
  5. } else {
  6. outputParameters[0] = 0;
  7. }
  8. }

How often is it called?

It is called as frequently as processBlock, but limited by the "Output data refresh rate" (Menu → Global Settings).

Output data refresh rate

Additional Explanation

In DSP, you can write to the outputParameters array (and outputStrings as well) at any time, in any function (e.g., processBlock, updateInputParameters, etc.). However, these output values are updated (posted to the DAW/GUI) only periodically, which is when computeOutputData is called.

Output parameters can be updated as frequently as once per block or less often, depending on the "Output data refresh rate" setting. For example, if the block size is 2048 samples and the sample rate is 48,000 Hz, processBlock will be called 23–24 times per second, and computeOutputData will be called just as often.

However, if you set a smaller buffer size, such as 128 samples, resulting in 375 calls per second to processBlock, computeOutputData will still be called no more than 50 times per second due to the "Output data refresh rate" setting.

This limitation helps reduce CPU usage, as frequent GUI refreshes are usually unnecessary.

As mentioned earlier, you can omit this function entirely and update your outputParameters within processBlock or another function. The parameters will still be updated in the GUI. However, this approach may lead to higher CPU usage, as you might write to the output parameters array more often than necessary, without any additional benefit.

Additional Note

Users can adjust the "Output data refresh rate" from 1 to 200 Hz (or even higher by editing the "global.pref" file located in "~Users\..\AppData\Roaming\{Manufacturer}\{PluginName}\"). By default, this value is set to 50 Hz for exported plugins.

Keep in mind that when you update outputParameters in DSP, the changes are not immediately reflected in the GUI. There is a delay due to asynchronous access to parameter data by the DSP and GUI. This delay depends on the ASIO buffer size, the "Output data refresh rate" value, and the GUI skin's "refresh_time_ms" and "refresh_priority" attributes.


Comments

Please, authorize to view and post comments.

2020 - 2026 © Site by LetiMix · Donate  |  Plug'n Script and KUIML by Blue Cat Audio