From 41403c98176597e09bbe9d873d230229b04345ad Mon Sep 17 00:00:00 2001 From: Oleksiy Date: Tue, 15 Sep 2026 23:39:09 +0300 Subject: [PATCH] Manual triggering now works --- Acid/Acid.ino | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Acid/Acid.ino b/Acid/Acid.ino index 8e6c27e..e7a8d42 100644 --- a/Acid/Acid.ino +++ b/Acid/Acid.ino @@ -7,8 +7,9 @@ // This code is licenced under GPL v3 or later // todo: -// debug accent handling that overloads the filter +// debug accent handling that overloads the filter, also accent can be too short or too long if it's relying on midi note // add overdrive +// frequency from CV (noteFreq) could be Q16n16 for consistency #include #include @@ -114,7 +115,7 @@ byte gain; bool MIDINotePlaying; bool MIDINoteFaded = true; bool gateIsHigh = false; -Q16n16 noteFreq; +float noteFreq; bool envSwitchVal; bool droneSwitchVal; byte MIDIChannel; @@ -126,7 +127,6 @@ bool accent = false; void MIDINoteOn(byte channel, byte note, byte velocity) { notePlaying = note; - noteFreq = Q16n16_mtof((int) note); if (velocity >= 127) { accent = true; @@ -276,7 +276,7 @@ void updateControl(){ //Set pitch and play notes on trigger if (MIDINoteFaded) { - noteFreq = Q16n16_mtof((float) kMapNote(CVInVal << 2) / pitchSubSteps); + noteFreq = mtof((float) kMapNote(CVInVal << 2) / pitchSubSteps); digitalWrite(LED, !gateInVal); if (gateInVal && !gateIsHigh) { gateIsHigh = true; @@ -297,9 +297,14 @@ void updateControl(){ //Set Oscilator Frequency Q16n16 oscFreq; - oscFreq = kGlide.next(); - aSquare.setFreq_Q16n16(oscFreq); - aSaw.setFreq_Q16n16(oscFreq); + if (!MIDINoteFaded) { + oscFreq = kGlide.next(); + aSquare.setFreq_Q16n16(oscFreq); + aSaw.setFreq_Q16n16(oscFreq); + } else { + aSquare.setFreq(noteFreq); + aSaw.setFreq(noteFreq); + } int env = kEnvelope.next();