Hi there
I’m following the cascading plugin effects tutorial on the AudioProcessorGraph. But there is a part missing, it sais :
In the next part, we iterate over the three available processor slots and check the options that were selected for each of the AudioParameterChoice objects as follows:
Then it shows the code for the prepareToPlay of the filterprocessor
void prepareToPlay (double sampleRate, int samplesPerBlock) override
{
juce::dsp::ProcessSpec spec { sampleRate, static_cast<juce::uint32> (samplesPerBlock) };
oscillator.prepare (spec);
}
Instead of the correct code:
for (int i = 0; i < 3; ++i)
{
auto& choice = choices.getReference (i);
auto slot = slots .getUnchecked (i);
if (choice->getIndex() == 0) // [1]
{
if (slot != nullptr)
{
mainProcessor->removeNode (slot.get());
slots.set (i, nullptr);
hasChanged = true;
}
}
else if (choice->getIndex() == 1) // [2]
{
if (slot != nullptr)
{
if (slot->getProcessor()->getName() == "Oscillator")
continue;
mainProcessor->removeNode (slot.get());
}
slots.set (i, mainProcessor->addNode (std::make_unique<OscillatorProcessor>()));
hasChanged = true;
}
else if (choice->getIndex() == 2) // [3]
{
if (slot != nullptr)
{
if (slot->getProcessor()->getName() == "Gain")
continue;
mainProcessor->removeNode (slot.get());
}
slots.set (i, mainProcessor->addNode (std::make_unique<GainProcessor>()));
hasChanged = true;
}
else if (choice->getIndex() == 3) // [4]
{
if (slot != nullptr)
{
if (slot->getProcessor()->getName() == "Filter")
continue;
mainProcessor->removeNode (slot.get());
}
slots.set (i, mainProcessor->addNode (std::make_unique<FilterProcessor>()));
hasChanged = true;
}
}
Just a heads up
