NoiceSynth/SharedState.cpp
2026-03-01 11:41:08 +01:00

38 lines
1.3 KiB
C++

#include <mutex>
#include "SharedState.h"
#include "synth_engine.h"
volatile int audioBufferUsage = 0;
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[] = {
{ "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;
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
SynthEngine* globalSynth = nullptr;