From d07b50491bd1fd88200d86b97239ea8a2a002093 Mon Sep 17 00:00:00 2001 From: Gordon JC Pearce Date: Tue, 31 Dec 2024 15:13:28 +0000 Subject: [PATCH] mostly indent --- plugin/voiceboard.cpp | 54 +++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/plugin/voiceboard.cpp b/plugin/voiceboard.cpp index 3b351ad..54c524b 100644 --- a/plugin/voiceboard.cpp +++ b/plugin/voiceboard.cpp @@ -73,10 +73,10 @@ void Synth::run() { // noise[i] = (1 - (tr21 & 0x00ffffff) / 8388608.0f) * (patchRam.noiseLevel * 0.0063); } - //printf("updating\n"); + // printf("updating\n"); for (uint8_t i = 0; i < NUM_VOICES; i++) { - voices[i].update(); + voices[i].update(); } } @@ -163,6 +163,7 @@ Voice::Voice() { } void Voice::calcPitch() { + uint16_t ea; uint16_t target = note << 8; // Portamento is a linear change of pitch - it'll take twice as long @@ -171,43 +172,42 @@ void Voice::calcPitch() { // This is implemented here by adding on a step value until you pass // the desired final pitch. Once that happens the value is clamped to the // desired pitch. - /* - if (ic29.portaCoeff != 0) { - // portamento up - if (pitch < target) { - pitch += ic29.portaCoeff; - if (pitch > target) pitch = target; - } - // portamento down - if (pitch > target) { - pitch -= ic29.portaCoeff; - if (pitch < target) pitch = target; - } - } else { - pitch = target; + + if (ic29.portaCoeff != 0) { + // portamento up + if (pitch < target) { + pitch += ic29.portaCoeff; + if (pitch > target) pitch = target; } + // portamento down + if (pitch > target) { + pitch -= ic29.portaCoeff; + if (pitch < target) pitch = target; + } + } else { + pitch = target; + } - pitch += ic29.masterPitch; + ea = pitch + ic29.masterPitch; - if (pitch < 0x3000) pitch = 0x3000; // lowest note - if (pitch > 0x9700) pitch = 0x6700; // highest note + if (ea < 0x3000) ea = 0x3000; // lowest note + if (ea > 0x9700) ea = 0x6700; // highest note - pitch -= 0x3000; + ea -= 0x3000; - // interpolate between the two table values - double o1 = ic29.pitchTable[pitch >> 8]; - double o2 = ic29.pitchTable[(pitch >> 8) + 1]; - double frac = (pitch & 0xff) / 256.0f; + // interpolate between the two table values + double o1 = ic29.pitchTable[ea >> 8]; + double o2 = ic29.pitchTable[(ea >> 8) + 1]; + double frac = (ea & 0xff) / 256.0f; - omega = ((o2 - o1) * frac) + o1; - */ + omega = ((o2 - o1) * frac) + o1; } void Voice::update() { // calculate the once-per-block values env.run(); calcPitch(); - //printf("env=%04x\n", env.level); + // printf("env=%04x\n", env.level); /* pw = (patchRam.switch1 & 0x08) ? ic29.pwm : 0.0f; saw = (ic29.patchRam.switch1 & 0x10) ? 1.0f : 0.0f;