From 81904ead80ef777510ad8800446012505e2630ea Mon Sep 17 00:00:00 2001 From: Gordon JC Pearce Date: Tue, 7 Jan 2025 12:25:10 +0000 Subject: [PATCH] better mixing --- plugin/alphaosc.cpp | 32 ++++++++++++++------------------ 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/plugin/alphaosc.cpp b/plugin/alphaosc.cpp index e8e4e2e..f0b0ef8 100644 --- a/plugin/alphaosc.cpp +++ b/plugin/alphaosc.cpp @@ -102,47 +102,43 @@ void AlphaOsc::run(const float **, float **outputs, uint32_t frames, const MidiE pwg = (float)((osc & 0x7f) >= pw) != 0; // calculate the oscillator output - in = wave = 0; switch (sqrmode) { case 0: case 4: - wave = 0; - break; // oscillator is off - case 1: - wave = sqr; + sqr = 0; // oscillator is off break; + case 1: // do nothing, sqr is fine + break; case 2: - wave = sqr * oct1; // 25% pulse + sqr *= oct1; // 25% pulse break; case 3: - wave = sqr * pwg; // pwm + sqr *= pwg; // pwm break; } - in += (wave * 0.63); // scaled similarly to Juno 106 - switch (sawmode) { case 0: - wave = 0; - break; // oscillator is off + saw = 0; + break; // oscillator is off case 1: - wave = saw; - break; + break; // saw is fine, do nothing case 2: - wave = saw * oct1; // pulsed + saw *= oct1; // pulsed break; case 3: - wave = saw * pwg; // pwm + saw *= pwg; // pwm break; case 4: - wave = saw * oct3; // oct3 pulse + saw *= oct3; // oct3 pulse break; case 5: - wave = saw * oct1 * oct3; // both pulse + saw *= oct1 * oct3; // both pulse break; } - in += (wave * 0.8); // scaled similarly to Juno 106 + // mix the signals, probably done with some resistors in the chip + in = (saw * 0.8) + (sqr * 0.63); // scaled similarly to Juno 106 // DC removal highpass filter // this is very approximately 6Hz at 44.1kHz and 48kHz