ASPiK SDK
|
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.
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:
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:
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:
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.