#ifndef SHARED_STATE_H #define SHARED_STATE_H #include "TrackerTypes.h" #include "MelodyStrategy.h" #include "config.h" // Global state variables defined in main .ino extern Step sequence[NUM_TRACKS][NUM_STEPS]; extern Step nextSequence[NUM_TRACKS][NUM_STEPS]; extern volatile bool sequenceChangeScheduled; extern volatile bool needsPanic; extern UIState currentState; // Menus extern const char* mainMenu[]; extern const int mainMenuCount; extern const char* randomizeMenuMono[]; extern const int randomizeMenuMonoCount; extern const int THEME_1_INDEX_MONO; extern const char* randomizeMenuPoly[]; extern const int randomizeMenuPolyCount; extern const int THEME_1_INDEX_POLY; extern const char* setupMenu[]; extern const int setupMenuCount; extern int menuSelection; extern volatile bool trackMute[NUM_TRACKS]; extern int randomizeTrack; extern volatile int playbackStep; extern volatile int midiChannels[NUM_TRACKS]; extern int scaleNotes[12]; extern int numScaleNotes; extern int melodySeeds[NUM_TRACKS]; extern volatile int queuedTheme; extern volatile int currentThemeIndex; extern const uint32_t EEPROM_MAGIC; extern MelodyStrategy* strategies[]; extern const int numStrategies; extern int currentStrategyIndices[NUM_TRACKS]; extern volatile PlayMode playMode; extern volatile bool mutationEnabled; extern volatile bool songModeEnabled; extern volatile int songRepeatsRemaining; extern volatile int nextSongRepeats; extern volatile bool songModeNeedsNext; extern volatile bool isPlaying; extern volatile int tempo; extern volatile unsigned long lastClockTime; extern volatile int clockCount; // Watchdog & Loop timing extern volatile unsigned long lastLoop0Time; extern volatile unsigned long lastLoop1Time; extern volatile bool watchdogActive; // Input state extern volatile int encoderDelta; extern bool lastButtonState; extern unsigned long lastDebounceTime; extern bool buttonActive; extern bool buttonConsumed; extern unsigned long buttonPressTime; #endif