Just copy if gain is null

This commit is contained in:
Paul Ferrand 2020-02-11 14:31:52 +01:00
parent 3a9fd31a0f
commit 498eee2dfc

View file

@ -30,9 +30,13 @@ void sfz::EQHolder::setup(const EQDescription& description, unsigned numChannels
void sfz::EQHolder::process(const float** inputs, float** outputs, unsigned numFrames) void sfz::EQHolder::process(const float** inputs, float** outputs, unsigned numFrames)
{ {
if (description == nullptr) { auto justCopy = [&]() {
for (unsigned channelIdx = 0; channelIdx < eq.channels(); channelIdx++) for (unsigned channelIdx = 0; channelIdx < eq.channels(); channelIdx++)
copy<float>({ inputs[channelIdx], numFrames }, { outputs[channelIdx], numFrames }); copy<float>({ inputs[channelIdx], numFrames }, { outputs[channelIdx], numFrames });
};
if (description == nullptr) {
justCopy();
return; return;
} }
@ -56,6 +60,11 @@ void sfz::EQHolder::process(const float** inputs, float** outputs, unsigned numF
} }
lastGain = Default::eqGainRange.clamp(lastGain); lastGain = Default::eqGainRange.clamp(lastGain);
if (lastGain == 0.0f) {
justCopy();
return;
}
eq.process(inputs, outputs, lastFrequency, lastBandwidth, lastGain, numFrames); eq.process(inputs, outputs, lastFrequency, lastBandwidth, lastGain, numFrames);
} }
float sfz::EQHolder::getLastFrequency() const float sfz::EQHolder::getLastFrequency() const