Fix to SfzFilter after changing channel count

This commit is contained in:
Jean Pierre Cimalando 2021-03-26 13:13:59 +01:00
parent cc6337e827
commit 731daf4ab8

View file

@ -154,8 +154,15 @@ void Filter::setChannels(unsigned channels)
{
ASSERT(channels <= Impl::maxChannels);
if (P->fChannels != channels) {
sfzFilterDsp *dsp = P->getDsp(P->fChannels, P->fType);
if (dsp)
dsp->~sfzFilterDsp();
P->fChannels = channels;
clear();
dsp = P->newDsp(channels, P->fType);
if (dsp)
dsp->init(P->fSampleRate);
}
}
@ -346,8 +353,15 @@ void FilterEq::setChannels(unsigned channels)
{
ASSERT(channels <= Impl::maxChannels);
if (P->fChannels != channels) {
sfzFilterDsp *dsp = P->getDsp(P->fChannels, P->fType);
if (dsp)
dsp->~sfzFilterDsp();
P->fChannels = channels;
clear();
dsp = P->newDsp(channels, P->fType);
if (dsp)
dsp->init(P->fSampleRate);
}
}