Hi, i’m creating a multiband compressor but i’m not sure about how should i handle the parameters.
This simple multiband comp works like this: i split the input signal in 3 bands and for each one i apply compression.
// splitSignal() splits signal into 3 bands.
// firstBandBuffer will contain the first band data and so on
bandSplitter.splitSignal(mainBuffer, firstBandBuffer, secondBandBuffer, thirdBandBuffer);
// instances of the same compressor class process the 3 bands separately
b1Comp.processBlock(firstBandBuffer, scBuffer);
b2Comp.processBlock(secondBandBuffer, scBuffer);
b3Comp.processBlock(thirdBandBuffer, scBuffer);
I have a PluginParameters.h where i add all my parameters to the layout.
Every compressor instance i use has his own attack time, release time, threshold, ratio, etc.
How should i manage this with the parameters?
Should i explicitly add the parameters like this?
static AudioProcessorValueTreeState::ParameterLayout createParameterLayout()
{
std::vector<std::unique_ptr<RangedAudioParameter>> params;
// band 1 compressor
params.push_back(std::make_unique<AudioParameterFloat>(nameAttackTime_band1, "Band 1 Attack Time (ms)", NormalisableRange<float>(0.05f, 250.0f, 0.01f, 0.35f), 0.05f));
params.push_back(std::make_unique<AudioParameterFloat>(nameAttackTime_band2, "Band 2 Attack Time (ms)", NormalisableRange<float>(0.05f, 250.0f, 0.01f, 0.35f), 0.05f));
params.push_back(std::make_unique<AudioParameterFloat>(nameAttackTime_band3, "Band 3 Attack Time (ms)", NormalisableRange<float>(0.05f, 250.0f, 0.01f, 0.35f), 0.05f));
return { params.begin(), params.end() };
}
and so on with all the parameters?
I mean, sure i can do a for loop to clean up the code but still idk if it’s really the right way to do it.
My multiband compressor has 3 bands but what if i wanna make something like the FabFilter Pro-MB where i can add bands dynamically? (I think it’s up to 6 bands but the point is making that number dynamic)
Hope you understood what i mean
Thank you for the attention!