BogaudioModules

BogaudioModules for VCV Rack
Log | Files | Refs | README | LICENSE

commit 711816e0266e5be603c0b17b6c8be77cb4999ed5
parent aa49a377cf1cdc285d0ce6e0ecdfbb5d121dba6d
Author: Matt Demanett <matt@demanett.net>
Date:   Wed,  1 Jan 2025 10:57:28 -0800

Fix LLFO to produce different stepped output values per channel when used polyphonically; new behavior matches LFO. #242

Diffstat:
Msrc/LLFO.cpp | 9+++++++--
Msrc/LLFO.hpp | 2+-
2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/LLFO.cpp b/src/LLFO.cpp @@ -122,7 +122,7 @@ void LLFO::modulate() { break; } case STEPPED_WAVE: { - _oscillator = &_stepped; + _oscillator = NULL; _samplingEnabled = false; break; } @@ -173,7 +173,12 @@ void LLFO::processChannel(const ProcessArgs& args, int c) { } } if (!useSample) { - _currentSample[c] = _oscillator->nextFromPhasor(_phasor[c]) * amplitude * _scale; + Phasor* oscillator = _oscillator; + if (!oscillator) { + assert(_wave == STEPPED_WAVE); + oscillator = &_stepped[c]; + } + _currentSample[c] = oscillator->nextFromPhasor(_phasor[c]) * amplitude * _scale; if (_invert) { _currentSample[c] = -_currentSample[c]; } diff --git a/src/LLFO.hpp b/src/LLFO.hpp @@ -76,7 +76,7 @@ struct LLFO : LFOBase { TriangleOscillator _triangle; SawOscillator _ramp; SquareOscillator _square; - SteppedRandomOscillator _stepped; + SteppedRandomOscillator _stepped[maxChannels]; bool _invert; Phasor* _oscillator; bool _samplingEnabled = false;