diff --git a/Soft/Rp2040/Rp2040.ino b/Soft/Rp2040/Rp2040.ino index 805b717e3193ab6022c8fc2559bcfbaf33281bbf..1341ffa6f3eb17002010182980e8f0d2d44f3ae9 100644 --- a/Soft/Rp2040/Rp2040.ino +++ b/Soft/Rp2040/Rp2040.ino @@ -6,6 +6,7 @@ #define FREQ_POT_PIN 27 #define INVERSION_PIN 28 #define CHORD_POT_PIN 29 +#define DEBUG_MODE false // 0-4=chord osc , 5=bass osc , 6=arpeggio osc float osc_progress[6]; @@ -102,7 +103,7 @@ void setup() { pinMode(PUSHBUTTON_PIN, INPUT_PULLUP);//push sw // Create the waveform and put it into the wavetable - wavetable_populate(); + wavetable_populate(waveform_selection); quantizer_select(); //-------------------octave select------------------------------- for (int i = 0; i < 1230; i++) {//Covers 6(=1230) octaves. If it is 1230 or more, the operation becomes unstable. @@ -178,10 +179,12 @@ void loop() { osc_freq = freq_table[qnt[thr] + freq_pot]; // V/oct apply osc_freq = 256 * osc_freq / 122070 * 8;//7 is base octave - Serial.print(analogRead(VOCT_PIN)); - Serial.print(","); - Serial.print(adc); - Serial.println(""); + if (DEBUG_MODE) { + Serial.print(analogRead(VOCT_PIN)); + Serial.print(","); + Serial.print(adc); + Serial.println(""); + } // -------------------chord mode select------------------------------- chord_mode = analogRead(CHORD_POT_PIN)/171; //171=1023/6 , 6 is amount of chord mode @@ -368,9 +371,11 @@ void loop() { push_sw = digitalRead(PUSHBUTTON_PIN); // TODO: Add propper debouncing for the button here if (push_sw == 0 && old_push_sw == 1) {//when push sw ON - // Change the selected waveform and ensure the selection is within bounds - waveform_selection = min(waveform_selection + 1, 6); - wavetable_populate(); + // Change the selected waveform and ensure the selection is within bounds+1 + waveform_selection = min(waveform_selection + 1, 8); + // Wrap around if we are around the last element + if (waveform_selection == 8) { waveform_selection = 0; } + wavetable_populate(waveform_selection); } } @@ -419,7 +424,7 @@ void quantizer_select(){ } // Populate the wavetable with values -void wavetable_populate() { +void wavetable_populate(int waveform_selection) { switch (waveform_selection) { // Sawtooth wave case 0: