From 3ec3204cd83d6863f641e2ff8c68358c3c183bee Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 30 Sep 2024 08:21:12 +0200 Subject: [PATCH] pass sample by reference --- clip/wavefolder.h | 6 ++---- synth/tx_operator.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/clip/wavefolder.h b/clip/wavefolder.h index ec8b520..40201ea 100644 --- a/clip/wavefolder.h +++ b/clip/wavefolder.h @@ -5,11 +5,9 @@ class wavefolder { public: float amount = 1.f; - float process_sample(float& _sample) + void process_sample(float& _sample) { - if (amount > 1.f) { return fold(_sample * amount); } - - return 0.f; + if (amount > 1.f) { _sample = fold(_sample * amount); } } private: diff --git a/synth/tx_operator.h b/synth/tx_operator.h index f010754..aad079f 100644 --- a/synth/tx_operator.h +++ b/synth/tx_operator.h @@ -30,7 +30,7 @@ public: // drifts and sounds better! if (envelope.is_busy()) { float osc = oscillator.process_sample(trigger, frequency, pm); - osc = wavefolding.process_sample(osc); + m_wavefolder.process_sample(osc); return osc * env * velocity; } else { return 0.;