Clamp the modulated cutoff to reasonable limits
This commit is contained in:
parent
87347f690f
commit
ffe708331b
1 changed files with 5 additions and 1 deletions
|
|
@ -5,6 +5,7 @@
|
|||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
||||
|
||||
#include "sfizz/SfzFilter.h"
|
||||
#include "sfizz/MathHelpers.h"
|
||||
#include "ui_DemoFilters.h"
|
||||
#include <QApplication>
|
||||
#include <QMainWindow>
|
||||
|
|
@ -294,7 +295,10 @@ int DemoApp::processAudio(jack_nframes_t nframes, void *cbdata)
|
|||
|
||||
for (jack_nframes_t i = 0; i < nframes; ++i) {
|
||||
float lfo = cutoffMod * triangleLfo(cutoffLfoPhase);
|
||||
tempCutoff[i] *= std::exp2(lfo * (1.0f / 12.0f));
|
||||
float modCutoff = tempCutoff[i];
|
||||
modCutoff *= std::exp2(lfo * (1.0f / 12.0f));
|
||||
modCutoff = clamp(modCutoff, 0.0f, 20000.0f);
|
||||
tempCutoff[i] = modCutoff;
|
||||
cutoffLfoPhase += cutoffRate * sampleTime;
|
||||
cutoffLfoPhase -= (int)cutoffLfoPhase;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue