127 lines
3.1 KiB
C
127 lines
3.1 KiB
C
#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
|
|
enum MenuItemID {
|
|
MENU_ID_GROUP_MAIN,
|
|
MENU_ID_PLAYBACK,
|
|
MENU_ID_MELODY,
|
|
MENU_ID_ROOT,
|
|
|
|
MENU_ID_GROUP_PROGRESSION,
|
|
MENU_ID_PROG_ORDER,
|
|
MENU_ID_PROG_APPLY_TEMPLATE,
|
|
MENU_ID_GROUP_PROG_SEQUENCE,
|
|
MENU_ID_PROG_LENGTH,
|
|
MENU_ID_PROG_STEP_START,
|
|
MENU_ID_PROG_STEP_END = MENU_ID_PROG_STEP_START + (MAX_PROG_STEPS * 3),
|
|
|
|
MENU_ID_TEMPO,
|
|
MENU_ID_SONG_MODE,
|
|
|
|
MENU_ID_GROUP_TRACK,
|
|
MENU_ID_TRACK_SELECT,
|
|
MENU_ID_MUTE,
|
|
MENU_ID_STEPS,
|
|
MENU_ID_FLAVOUR,
|
|
MENU_ID_INTENSITY,
|
|
MENU_ID_CHANCE,
|
|
MENU_ID_MUTATION,
|
|
MENU_ID_THEME_1,
|
|
MENU_ID_THEME_2,
|
|
MENU_ID_THEME_3,
|
|
MENU_ID_THEME_4,
|
|
MENU_ID_THEME_5,
|
|
MENU_ID_THEME_6,
|
|
MENU_ID_THEME_7,
|
|
|
|
MENU_ID_GROUP_SETUP,
|
|
MENU_ID_CHANNEL,
|
|
MENU_ID_PROTECTED_MODE,
|
|
MENU_ID_RESET,
|
|
|
|
MENU_ID_GROUP_PATCHES,
|
|
MENU_ID_BANK_1,
|
|
MENU_ID_BANK_2,
|
|
MENU_ID_BANK_3,
|
|
MENU_ID_BANK_4,
|
|
MENU_ID_PATCH_ACTIONS_START
|
|
};
|
|
|
|
struct MenuItem {
|
|
const char* label;
|
|
MenuItemID id;
|
|
bool isGroup;
|
|
bool expanded;
|
|
int indentLevel;
|
|
};
|
|
|
|
extern MenuItem menuItems[];
|
|
extern const int menuItemsCount;
|
|
bool isItemVisible(int index);
|
|
|
|
extern int menuSelection;
|
|
extern volatile bool trackMute[NUM_TRACKS];
|
|
extern int randomizeTrack;
|
|
extern volatile int numSteps[NUM_TRACKS];
|
|
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 int globalRoot;
|
|
extern int currentRoot;
|
|
extern volatile int trackIntensity[NUM_TRACKS];
|
|
extern volatile int trackChance[NUM_TRACKS];
|
|
extern int currentScaleType;
|
|
extern ChordProgression currentProgression;
|
|
extern ProgressionOrder progressionOrder;
|
|
extern int progressionStep;
|
|
extern volatile int queuedProgressionStep;
|
|
extern volatile int visualProgressionStep;
|
|
extern const ChordProgression progressions[];
|
|
extern const int numProgressions;
|
|
extern int templateSelectionIndex;
|
|
extern int stepEditIndex;
|
|
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 bool protectedMode;
|
|
extern volatile int tempo;
|
|
extern volatile unsigned long lastClockTime;
|
|
extern volatile int clockCount;
|
|
|
|
// Input state
|
|
extern volatile int encoderDelta;
|
|
extern bool lastButtonState;
|
|
extern unsigned long lastDebounceTime;
|
|
extern bool buttonActive;
|
|
extern bool buttonConsumed;
|
|
extern unsigned long buttonPressTime;
|
|
|
|
#endif
|