From 5afc5ff18a136d9f6385d5ba6a8d25114a51022f Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 1 Oct 2024 11:23:03 +0200 Subject: [PATCH] nicer code --- synth/tx_operator.h | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/synth/tx_operator.h b/synth/tx_operator.h index d209eaa..22bf0dc 100644 --- a/synth/tx_operator.h +++ b/synth/tx_operator.h @@ -27,17 +27,14 @@ public: { float env = envelope_enabled ? envelope.process_sample(gate, trigger) : 1.f; - // drifts and sounds better! - if (envelope.is_busy()) { - float osc = oscillator.process_sample(trigger, frequency, pm); - folder.process_sample(osc); + if (!envelope.is_busy()) return 0.f; - float adjusted_velocity = velocity_enabled ? velocity : 1.f; + float osc = oscillator.process_sample(trigger, frequency, pm); + folder.process_sample(osc); - return osc * env * adjusted_velocity; - } else { - return 0.; - } + float adjusted_velocity = velocity_enabled ? velocity : 1.f; + + return osc * env * adjusted_velocity; } void set_samplerate(double samplerate)