#ifndef XRSequenceInstrumentTrackProgram_h #define XRSequenceInstrumentTrackProgram_h #include <Arduino.h> #include <vector> #include <string> enum class InstrumentTrackProgramState { ACTIVE = 0, // you only have to specify the first value, the compiler does the rest, but w/e REST = 1 }; enum class ConfigPropSettingsType { BANK_NUMBER = 0, // you only have to specify the first value, the compiler does the rest, but w/e PROGRAM_NUMBER = 1, BAR_LENGTH = 2, STATE = 3, LAST_STEP = 4 }; struct ConfigPropSettingsTemplate { std::vector<std::string> bankNumberOpts = { "01", "02", "03", "04" }; int programNumberVal = 1; int barLengthVal = 1; std::vector<std::string> stateOpts = { "ACTIVE", "REST" }; int lastStep = 16; }; class SequenceInstrumentTrackProgram { public: int trackIndex = 1; // associated track int pIndex = 1; unsigned int bankNumber = 0; unsigned int programNumber = 1; unsigned int barLength = 1; unsigned int state = 0; // default state (0=ON) unsigned int lastStep = 16; // default step len unsigned int oldBankNumber = 0; unsigned int oldProgramNumber = 1; unsigned int oldBarLength = 1; unsigned int oldState = 0; // default state (0=ON) unsigned int oldLastStep = 16; // default step len static const unsigned int configPropCount = 5; ConfigPropSettingsTemplate configPropOptions; std::vector<std::string> bankNumberOpts; int programNumberVal = 1; int barLengthVal = 1; std::vector<std::string> stateOpts; int lastStepVal = 16; SequenceInstrumentTrackProgram (int trackIdx, int prgIdx) { this->trackIndex = trackIdx; this->pIndex = prgIdx; // refactor so this is unnecessary this->bankNumberOpts = configPropOptions.bankNumberOpts; this->programNumberVal = configPropOptions.programNumberVal; this->barLengthVal = configPropOptions.barLengthVal; this->stateOpts = configPropOptions.stateOpts; this->lastStepVal = configPropOptions.lastStep; } void toggleState(); void setConfigProp(unsigned int prop, unsigned int val); void undoChanges(); static unsigned int getConfigPropCount(); unsigned int getConfigPropSettingMax(unsigned int prop) const; const char* getConfigPropName(unsigned int prop); const char* getConfigPropNameShort(unsigned int prop); std::string getConfigPropSettingOption(unsigned int prop, unsigned int opt) const; std::string getConfigPropSettingValue(unsigned int prop) const; private: unsigned int configProps[configPropCount] = { this->bankNumber, this->programNumber, this->barLength, this->lastStep }; const int configPropValueDefaults[configPropCount] = { 1, 1, 1, (int) InstrumentTrackProgramState::ACTIVE, 16 }; const char *configPropNames[configPropCount] = { "Bank", "Program Number", "Bar Length", "State", "Last Step" }; const char *configPropNamesShort[configPropCount] = { "Bank", "Pgm. Num.", "Bar Len.", "State", "Last Step" }; }; #endif /* XRSequenceInstrumentTrackProgram_h */