commit 5e32bafc51fff9bda97512111fea3e4b8db670da
parent 2a3fc9a5b3d9d4f3eb747a8b784bb9b31b4a7a47
Author: Matt Demanett <matt@demanett.net>
Date: Thu, 20 Aug 2020 21:18:50 -0400
CHIRP, RANALYZER: fix chirps to start with zero phase.
Diffstat:
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/Chirp.cpp b/src/Chirp.cpp
@@ -84,7 +84,13 @@ void Chirp::processChannel(const ProcessArgs& args, int c) {
Engine& e = *_engines[c];
bool triggered = e.trigger.process(params[TRIGGER_PARAM].getValue()*5.0f + inputs[TRIGGER_INPUT].getPolyVoltage(c));
- _run = _run || triggered || _loop;
+ if (!_run) {
+ if (triggered || _loop) {
+ _run = true;
+ e.chirp.reset();
+ }
+ }
+
float out = 0.0f;
if (_run) {
out = e.chirp.next() * 5.0f;
diff --git a/src/dsp/oscillator.cpp b/src/dsp/oscillator.cpp
@@ -354,6 +354,7 @@ float ChirpOscillator::_next() {
void ChirpOscillator::reset() {
_time = 0.0f;
+ _oscillator.resetPhase();
}