From 023b8192a522cfdabc9aa807f11172f0a7b69bed Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 1 Oct 2024 11:51:32 +0200 Subject: [PATCH] fix envelope calculation --- synth/tx_operator.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/synth/tx_operator.h b/synth/tx_operator.h index 22bf0dc..1a024a7 100644 --- a/synth/tx_operator.h +++ b/synth/tx_operator.h @@ -25,9 +25,12 @@ public: float process_sample(const bool& gate, const bool& trigger, const float& frequency, const float& velocity, const float& pm = 0) { - float env = envelope_enabled ? envelope.process_sample(gate, trigger) : 1.f; + float env = 1.f; - if (!envelope.is_busy()) return 0.f; + if (envelope_enabled) { + env = envelope.process_sample(gate, trigger); + if (!envelope.is_busy()) return 0.f; + } float osc = oscillator.process_sample(trigger, frequency, pm); folder.process_sample(osc);