I’m learning about using AudioProcessorParameter classes (such as AudioParameterFloat) in order to have the GUI elements of my application feed into my AudioProcessor. In the related tutorial (Tutorial: Adding plug-in parameters) it wants me to feed my gain parameter into AudioBuffer.applyGain.
But isn’t that bad programming style? Because applyGain applies itself to every sample in the buffer, meaning it will iterate through every sample in the buffer in order to do the multiplication. And unless it’s not already clear, we are already looping through every sample in order to do our DSP.
Isn’t it better to just throw a
sample * gain right in the processBlock loop rather than doing our DSP, then doing another round of DSP via
Or am I misunderstanding how applyGain works?
If it is indeed better to multiply right inside the processBlock AudioBuffer loop, then get() the current parameter value would be the preferred way of doing it, right? (
sample * gain->get())