debugging buffer
This commit is contained in:
parent
032d9f3e1a
commit
16c22072a1
26
FM/FM.ino
26
FM/FM.ino
|
@ -75,17 +75,18 @@ void updateBuffer(byte bNote, bool bGate) {
|
|||
playNote();
|
||||
bufferIndex++;
|
||||
}
|
||||
if (bGate == 0 && bufferIndex != 0) {
|
||||
if (bGate == 0) { // && bufferIndex != 0
|
||||
for (int i = 0; i <= bufferIndex; i++) {
|
||||
if (noteBuffer[i] == bNote) {
|
||||
// Removing the note from the array and shifting everything to close the gap
|
||||
for (int n = i; n <= bufferIndex; n++) {
|
||||
noteBuffer[n] = noteBuffer[n + 1]; // what happens if it's the last note in buffer?
|
||||
}
|
||||
if (i == bufferIndex) {
|
||||
if (i == bufferIndex) { //this does not fire
|
||||
bufferIndex--;
|
||||
gate = 1;
|
||||
playNote();
|
||||
} else {
|
||||
} else { //this does fire
|
||||
bufferIndex--;
|
||||
}
|
||||
}
|
||||
|
@ -138,6 +139,7 @@ void updateControl(){
|
|||
aCarrier.setFreq(carrier_freq);
|
||||
aModulator.setFreq(mod_freq);
|
||||
|
||||
//Knob 1
|
||||
int Knob1value= mozziAnalogRead(CONTROLL1); // value is 0-1023
|
||||
int Knob1calibrated = kMapIntensity(Knob1value);
|
||||
|
||||
|
@ -151,6 +153,24 @@ void updateControl(){
|
|||
float mod_speed = (float)kMapModSpeed(Knob2value)/1000;
|
||||
kIntensityMod.setFreq(mod_speed);
|
||||
|
||||
// Debugging
|
||||
Serial.print("Buffer Index: ");
|
||||
Serial.print(bufferIndex);
|
||||
|
||||
Serial.print(" | Knob1: "); //3rd on the pannel, connected to A0
|
||||
Serial.print(Knob1calibrated);
|
||||
|
||||
Serial.print(" | Knob2: "); //2nd on the pannel, conntcted to A1
|
||||
Serial.print(Knob2value);
|
||||
|
||||
Serial.print(" | Knob3: "); //1st on the pannel, connected to A2, unstable around 0
|
||||
Serial.print(FRQ);
|
||||
|
||||
Serial.print(" | Knob4: "); //4th on the pannel, A3
|
||||
Serial.print(knob4calibrated);
|
||||
|
||||
Serial.println();
|
||||
|
||||
// MIDI DIN
|
||||
MIDI.read();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue