refactor(fx): give each FX slot independent DSP history

Replace the single shared array of 9 effect units with a 2D array
of kNumFxSlots × kNumEffectTypes, so each slot owns its own DSP
state. This prevents state bleed when the same effect type appears
in multiple slots and allows reordering without carrying over
internal history.

Track activeTypes to skip unchanged slots. Remove the dry buffer
since it was unused.
This commit is contained in:
2026-09-09 14:32:58 +02:00
parent dc6fd88ed1
commit 4748bfe768
2 changed files with 20 additions and 15 deletions
+15 -12
View File
@@ -14,24 +14,27 @@ namespace serum
FXProcessor::FXProcessor()
{
units[0] = std::make_unique<HyperUnit>();
units[1] = std::make_unique<ChorusUnit>();
units[2] = std::make_unique<FlangerUnit>();
units[3] = std::make_unique<PhaserUnit>();
units[4] = std::make_unique<DistortionUnit>();
units[5] = std::make_unique<EQUnit>();
units[6] = std::make_unique<CompressorUnit>();
units[7] = std::make_unique<DelayUnit>();
units[8] = std::make_unique<ReverbUnit>();
for (auto& slotUnits : units)
{
slotUnits[0] = std::make_unique<HyperUnit>();
slotUnits[1] = std::make_unique<ChorusUnit>();
slotUnits[2] = std::make_unique<FlangerUnit>();
slotUnits[3] = std::make_unique<PhaserUnit>();
slotUnits[4] = std::make_unique<DistortionUnit>();
slotUnits[5] = std::make_unique<EQUnit>();
slotUnits[6] = std::make_unique<CompressorUnit>();
slotUnits[7] = std::make_unique<DelayUnit>();
slotUnits[8] = std::make_unique<ReverbUnit>();
}
}
FXProcessor::~FXProcessor() = default;
void FXProcessor::prepare (double sampleRate, int maxBlockSize)
{
for (auto& u : units)
u->prepare (sampleRate, maxBlockSize);
dry.setSize (2, maxBlockSize, false, false, true);
for (auto& slotUnits : units)
for (auto& u : slotUnits)
u->prepare (sampleRate, maxBlockSize);
wet.setSize (2, maxBlockSize, false, false, true);
reset();
}