No Matches
The Buffer Processing Cycle

The buffer processing cycle is complex but it is also defined and explained in high detail for AU, AAX, VST and the resulting ASPiK framework implementation in Designing Audio Effects Plugins in C++D 2nd Ed. by Will Pirkle so we won't go into major details here. The figure below shows the layout of a generic audio plugin's buffer processing cycle:

You can see from the above figure that the buffer processing cycle consists of three components: reading incoming parameter updates from the GUI controls, processing the audio, then writing output parameter information to the VU meters or other output-only controls. The PluginBase defines three functions that correspond to this three-step architecture. These three functions will always be called in this exact order during each and every buffer processing cycle.

// --- preProcess: sync GUI parameters here
virtual bool preProcessAudioBuffers(ProcessBufferInfo& processInfo);
// --- process buffers – the DSP
virtual bool processAudioBuffers(ProcessBufferInfo& processBufferInfo);
// --- postProcess: do update meters, plots, graphs
virtual bool postProcessAudioBuffers(ProcessBufferInfo& processInfo);
Information package that arrives with each new audio buffer process cycle. Contains everything needed...
Definition: pluginstructures.h:1123

Buffer Pre-Processing
During the pre-processing phase, we make a single call to the function that synchronizes our plugin variables with the values stored in our plugin parameters. During this phase, it is impossible for the DAW, GUI or other entity to manipulate the parameters or the variables. The pre-processing function is:

// --- do pre buffer processing
// --- sync internal variables to GUI parameters
return true;
void syncInBoundVariables()
initialize object for a new run of audio; called just before audio streams
Definition: pluginbase.cpp:105
virtual bool preProcessAudioBuffers(ProcessBufferInfo &processInfo)
do anything needed prior to arrival of audio buffers
Definition: plugincore.cpp:103

The syncInBoundVariables method has two components. The first part simply copies the updated parameter information into the bound variables we supplied during the parameter instantiation. More importantly, this function calls a secondary function that allows you to do any post-update calculations. This base class function is implemented in the PluginCore:

bool postUpdatePluginParameter(int32_t controlID, double controlValue, ParameterUpdateInfo& paramInfo);
Information about a paraemeter being updated. Used when bound variables are updated....
Definition: pluginstructures.h:835

This function will be called for every parameter that is updated and will give you the chance to “cook” any variables that may need alteration as a result. We will demonstrate when you might use this function shortly. The incoming ParameterUpdateInfo structure contains boolean flags that will indicate why this function was called. Once the pre-processing phase is complete, your plugin needs to be fully setup to process audio. We will show an example of using this function later.

Buffer Post-Processing
The postProcessAudioBuffers method is called after all incoming buffers have been processed. The default implementation for this function is:

// --- update outbound variables
return true;
bool updateOutBoundVariables()
copy newly updated metering variables into GUI parameters for display
Definition: pluginbase.cpp:308
virtual bool postProcessAudioBuffers(ProcessBufferInfo &processInfo)
do anything needed prior to arrival of audio buffers
Definition: plugincore.cpp:411

This function simply calls the sub-function updateOutboundVariables which copies output parameter values into a special list that will be delivered back to the native parameter list, and then back to the GUI in a thread-safe manner. You won't need to modify or mess with that function, but this is the opportunity for your plugin to do any other processing after the buffer processing is completed. This would only include processing after ALL audio data has been processed.