Menu with button support to switch wave tables

This commit is contained in:
Dejvino
2026-02-27 06:48:19 +01:00
parent 59b48c1ab3
commit 34d15a7f1c
4 changed files with 196 additions and 42 deletions
+23 -5
View File
@@ -4,11 +4,29 @@ volatile unsigned long lastLoop0Time = 0;
volatile unsigned long lastLoop1Time = 0;
volatile bool watchdogActive = false;
UIState currentState = UI_MENU;
volatile int menuSelection = 0;
const MenuItem MENU_ITEMS[] = {
{ "Scale Type", UI_EDIT_SCALE_TYPE },
{ "Scale Key", UI_EDIT_SCALE_KEY },
{ "Wavetable", UI_EDIT_WAVETABLE }
};
const int NUM_MENU_ITEMS = sizeof(MENU_ITEMS) / sizeof(MENU_ITEMS[0]);
const Scale SCALES[] = {
{ "C Major", { 261.63, 293.66, 329.63, 349.23, 392.00, 440.00, 493.88, 523.25 }, 8 },
{ "C Minor", { 261.63, 293.66, 311.13, 349.23, 392.00, 415.30, 466.16, 523.25 }, 8 },
{ "Pentatonic", { 261.63, 293.66, 329.63, 392.00, 440.00, 523.25, 587.33, 659.25 }, 8 },
{ "Blues", { 261.63, 311.13, 349.23, 369.99, 392.00, 466.16, 523.25, 587.33 }, 8 }
{ "Major", { 0, 2, 4, 5, 7, 9, 11, 12 }, 8 },
{ "Minor", { 0, 2, 3, 5, 7, 8, 10, 12 }, 8 },
{ "Pentatonic", { 0, 2, 4, 7, 9, 12, 14, 16 }, 8 },
{ "Blues", { 0, 3, 5, 6, 7, 10, 12, 14 }, 8 }
};
const int NUM_SCALES = sizeof(SCALES) / sizeof(SCALES[0]);
volatile int currentScaleIndex = 0;
volatile int currentScaleIndex = 0;
const char* KEY_NAMES[] = {"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"};
const int NUM_KEYS = sizeof(KEY_NAMES) / sizeof(KEY_NAMES[0]);
volatile int currentKeyIndex = 0; // C
const char* WAVETABLE_NAMES[] = {"Sine", "Square", "Saw", "Triangle"};
const int NUM_WAVETABLES = sizeof(WAVETABLE_NAMES) / sizeof(WAVETABLE_NAMES[0]);
volatile int currentWavetableIndex = 0; // Sine