Manual triggering now works

This commit is contained in:
Oleksiy
2026-09-15 23:39:09 +03:00
parent 29e5c12777
commit 41403c9817

View File

@ -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 <Mozzi.h>
#include <MIDI.h>
@ -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();