Play and Setup menu only and no Tracker

This commit is contained in:
Dejvino 2026-02-18 19:08:04 +01:00
parent 5ea0070283
commit da30471f31
5 changed files with 45 additions and 195 deletions

View File

@ -44,6 +44,6 @@ void MidiDriver::sendRealtime(uint8_t status) {
void MidiDriver::panic(uint8_t channel) { void MidiDriver::panic(uint8_t channel) {
uint8_t status = 0xB0 | (channel - 1); uint8_t status = 0xB0 | (channel - 1);
Serial1.write(status); Serial1.write(status);
Serial1.write(123); // All Notes Off Serial1.write((uint8_t)123); // All Notes Off
Serial1.write((uint8_t)0); Serial1.write((uint8_t)0);
} }

View File

@ -15,16 +15,16 @@ Step nextSequence[NUM_TRACKS][NUM_STEPS];
volatile bool sequenceChangeScheduled = false; volatile bool sequenceChangeScheduled = false;
volatile bool needsPanic = false; volatile bool needsPanic = false;
UIState currentState = UI_MENU_MAIN; UIState currentState = UI_MENU_RANDOMIZE; // Let's start in the Play menu
const char* mainMenu[] = { "Tracker", "Randomize", "Setup" }; const char* mainMenu[] = { "Randomize", "Setup" };
const int mainMenuCount = sizeof(mainMenu) / sizeof(char*); const int mainMenuCount = sizeof(mainMenu) / sizeof(char*);
const char* randomizeMenuMono[] = { "Back", "Melody", "Flavour", "Scale", "Tempo", "Mutation", "Song Mode", "Theme 1", "Theme 2", "Theme 3", "Theme 4", "Theme 5", "Theme 6", "Theme 7" }; const char* randomizeMenuMono[] = { "Setup", "Melody", "Flavour", "Scale", "Tempo", "Mutation", "Song Mode", "Theme 1", "Theme 2", "Theme 3", "Theme 4", "Theme 5", "Theme 6", "Theme 7" };
const int randomizeMenuMonoCount = sizeof(randomizeMenuMono) / sizeof(char*); const int randomizeMenuMonoCount = sizeof(randomizeMenuMono) / sizeof(char*);
const int THEME_1_INDEX_MONO = 7; const int THEME_1_INDEX_MONO = 7;
const char* randomizeMenuPoly[] = { "Back", "Track", "Mute", "Melody", "Flavour", "Scale", "Tempo", "Mutation", "Song Mode", "Theme 1", "Theme 2", "Theme 3", "Theme 4", "Theme 5", "Theme 6", "Theme 7" }; const char* randomizeMenuPoly[] = { "Setup", "Track", "Mute", "Melody", "Flavour", "Scale", "Tempo", "Mutation", "Song Mode", "Theme 1", "Theme 2", "Theme 3", "Theme 4", "Theme 5", "Theme 6", "Theme 7" };
const int randomizeMenuPolyCount = sizeof(randomizeMenuPoly) / sizeof(char*); const int randomizeMenuPolyCount = sizeof(randomizeMenuPoly) / sizeof(char*);
const int THEME_1_INDEX_POLY = 9; const int THEME_1_INDEX_POLY = 9;
@ -32,8 +32,6 @@ const char* setupMenu[] = { "Back", "Play Mode", "Channel", "Factory Reset" };
const int setupMenuCount = sizeof(setupMenu) / sizeof(char*); const int setupMenuCount = sizeof(setupMenu) / sizeof(char*);
int menuSelection = 0; int menuSelection = 0;
volatile int navigationSelection = 1;
volatile int currentTrack = 0;
volatile bool trackMute[NUM_TRACKS]; volatile bool trackMute[NUM_TRACKS];
int randomizeTrack = 0; int randomizeTrack = 0;
volatile int playbackStep = 0; volatile int playbackStep = 0;
@ -43,7 +41,7 @@ int numScaleNotes = 0;
int melodySeeds[NUM_TRACKS]; int melodySeeds[NUM_TRACKS];
volatile int queuedTheme = -1; volatile int queuedTheme = -1;
volatile int currentThemeIndex = 1; volatile int currentThemeIndex = 1;
const uint32_t EEPROM_MAGIC = 0x4242424A; const uint32_t EEPROM_MAGIC = 0x4242424B;
MelodyStrategy* strategies[] = { new LuckyStrategy(), new ArpStrategy(), new EuclideanStrategy() }; MelodyStrategy* strategies[] = { new LuckyStrategy(), new ArpStrategy(), new EuclideanStrategy() };
const int numStrategies = 3; const int numStrategies = 3;
@ -55,8 +53,6 @@ volatile bool songModeEnabled = false;
volatile int songRepeatsRemaining = 0; volatile int songRepeatsRemaining = 0;
volatile int nextSongRepeats = 0; volatile int nextSongRepeats = 0;
volatile bool songModeNeedsNext = false; volatile bool songModeNeedsNext = false;
volatile EditMode editMode = NAV_STEP;
volatile int scrollOffset = 0;
volatile bool isPlaying = false; volatile bool isPlaying = false;
volatile int tempo = 120; // BPM volatile int tempo = 120; // BPM
volatile unsigned long lastClockTime = 0; volatile unsigned long lastClockTime = 0;
@ -255,33 +251,6 @@ void handleInput() {
if (delta != 0) { if (delta != 0) {
switch(currentState) { switch(currentState) {
case UI_TRACKER:
if (editMode == EDIT_NOTE && navigationSelection > 0) {
// Change Note
int stepIndex = navigationSelection - 1;
int newNote = sequence[currentTrack][stepIndex].note + delta;
if (newNote < -1) newNote = -1;
if (newNote > 127) newNote = 127;
midi.lock();
sequence[currentTrack][stepIndex].note = newNote;
midi.unlock();
} else if (editMode == NAV_TRACK) {
midi.lock();
currentTrack += (delta > 0 ? 1 : -1);
if(currentTrack < 0) currentTrack = NUM_TRACKS - 1;
if(currentTrack >= NUM_TRACKS) currentTrack = 0;
midi.unlock();
} else {
// Move Cursor
navigationSelection += (delta > 0 ? 1 : -1);
if (navigationSelection < 0) navigationSelection = NUM_STEPS;
if (navigationSelection > NUM_STEPS) navigationSelection = 0;
// Adjust Scroll to keep cursor in view
if (navigationSelection < scrollOffset) scrollOffset = navigationSelection;
if (navigationSelection >= scrollOffset + 6) scrollOffset = navigationSelection - 5;
}
break;
case UI_MENU_MAIN: case UI_MENU_MAIN:
menuSelection += (delta > 0 ? 1 : -1); menuSelection += (delta > 0 ? 1 : -1);
if (menuSelection < 0) menuSelection = mainMenuCount - 1; if (menuSelection < 0) menuSelection = mainMenuCount - 1;
@ -302,7 +271,7 @@ void handleInput() {
break; break;
case UI_SETUP_CHANNEL_EDIT: case UI_SETUP_CHANNEL_EDIT:
{ {
int trackToEdit = (playMode == MODE_POLY) ? currentTrack : 0; int trackToEdit = (playMode == MODE_POLY) ? randomizeTrack : 0;
midiChannels[trackToEdit] += (delta > 0 ? 1 : -1); midiChannels[trackToEdit] += (delta > 0 ? 1 : -1);
if (midiChannels[trackToEdit] < 1) midiChannels[trackToEdit] = 16; if (midiChannels[trackToEdit] < 1) midiChannels[trackToEdit] = 16;
if (midiChannels[trackToEdit] > 16) midiChannels[trackToEdit] = 1; if (midiChannels[trackToEdit] > 16) midiChannels[trackToEdit] = 1;
@ -323,8 +292,6 @@ void handleInput() {
break; break;
case UI_SETUP_PLAYMODE_EDIT: case UI_SETUP_PLAYMODE_EDIT:
playMode = (playMode == MODE_MONO) ? MODE_POLY : MODE_MONO; playMode = (playMode == MODE_MONO) ? MODE_POLY : MODE_MONO;
// Reset edit mode when switching
editMode = NAV_STEP;
break; break;
} }
if (currentState == UI_RANDOMIZE_TRACK_EDIT) { if (currentState == UI_RANDOMIZE_TRACK_EDIT) {
@ -356,31 +323,15 @@ void handleInput() {
buttonActive = false; buttonActive = false;
if (!buttonConsumed) { // Short press action if (!buttonConsumed) { // Short press action
switch(currentState) { switch(currentState) {
case UI_TRACKER:
if (navigationSelection == 0) { // Menu item selected
currentState = UI_MENU_MAIN;
menuSelection = 0;
} else { // A step is selected
editMode = (EditMode)((editMode + 1) % 3);
// In mono mode, skip track navigation
if(playMode == MODE_MONO && editMode == NAV_TRACK) {
editMode = EDIT_NOTE;
}
if(editMode == NAV_STEP) { // Cycled back to start
// No action needed
}
}
break;
case UI_MENU_MAIN: case UI_MENU_MAIN:
if (menuSelection == 0) { currentState = UI_TRACKER; break; } if (menuSelection == 0) { currentState = UI_MENU_RANDOMIZE; menuSelection = 0; break; }
if (menuSelection == 1) { currentState = UI_MENU_RANDOMIZE; menuSelection = 0; break; } if (menuSelection == 1) { currentState = UI_MENU_SETUP; menuSelection = 0; break; }
if (menuSelection == 2) { currentState = UI_MENU_SETUP; menuSelection = 0; break; }
break; break;
case UI_MENU_RANDOMIZE: case UI_MENU_RANDOMIZE:
{ {
int track_offset = (playMode == MODE_POLY) ? 2 : 0; int track_offset = (playMode == MODE_POLY) ? 2 : 0;
int theme_1_index = (playMode == MODE_POLY) ? THEME_1_INDEX_POLY : THEME_1_INDEX_MONO; int theme_1_index = (playMode == MODE_POLY) ? THEME_1_INDEX_POLY : THEME_1_INDEX_MONO;
if (menuSelection == 0) { currentState = UI_MENU_MAIN; menuSelection = 1; break; } if (menuSelection == 0) { currentState = UI_MENU_SETUP; menuSelection = 0; break; }
if (playMode == MODE_POLY) { if (playMode == MODE_POLY) {
if (menuSelection == 1) { currentState = UI_RANDOMIZE_TRACK_EDIT; break; } if (menuSelection == 1) { currentState = UI_RANDOMIZE_TRACK_EDIT; break; }
if (menuSelection == 2) { trackMute[randomizeTrack] = !trackMute[randomizeTrack]; break; } if (menuSelection == 2) { trackMute[randomizeTrack] = !trackMute[randomizeTrack]; break; }
@ -441,7 +392,7 @@ void handleInput() {
} }
break; break;
case UI_MENU_SETUP: case UI_MENU_SETUP:
if (menuSelection == 0) { currentState = UI_MENU_MAIN; menuSelection = 2; break; } if (menuSelection == 0) { currentState = UI_MENU_RANDOMIZE; menuSelection = 0; break; }
if (menuSelection == 1) { currentState = UI_SETUP_PLAYMODE_EDIT; break; } if (menuSelection == 1) { currentState = UI_SETUP_PLAYMODE_EDIT; break; }
if (menuSelection == 2) { currentState = UI_SETUP_CHANNEL_EDIT; break; } if (menuSelection == 2) { currentState = UI_SETUP_CHANNEL_EDIT; break; }
if (menuSelection == 3) { factoryReset(); break; } if (menuSelection == 3) { factoryReset(); break; }
@ -484,22 +435,19 @@ void handleInput() {
// Check for Long Press (Start/Stop Playback) // Check for Long Press (Start/Stop Playback)
if (buttonActive && !buttonConsumed && (millis() - buttonPressTime > 600)) { if (buttonActive && !buttonConsumed && (millis() - buttonPressTime > 600)) {
// Long press only works from tracker view isPlaying = !isPlaying;
if (currentState == UI_TRACKER) { buttonConsumed = true; // Prevent short press action
isPlaying = !isPlaying; Serial.print(F("Playback: ")); Serial.println(isPlaying ? F("ON") : F("OFF"));
buttonConsumed = true; // Prevent short press action if (isPlaying) {
Serial.print(F("Playback: ")); Serial.println(isPlaying ? F("ON") : F("OFF")); playbackStep = 0;
if (isPlaying) { clockCount = 0;
playbackStep = 0; lastClockTime = micros();
clockCount = 0; midi.sendRealtime(0xFA); // MIDI Start
lastClockTime = micros(); } else {
midi.sendRealtime(0xFA); // MIDI Start // Send All Notes Off on stop (CC 123)
} else { needsPanic = true;
// Send All Notes Off on stop (CC 123) midi.sendRealtime(0xFC); // MIDI Stop
needsPanic = true; queuedTheme = -1;
midi.sendRealtime(0xFC); // MIDI Stop
queuedTheme = -1;
}
} }
} }
@ -623,25 +571,21 @@ void drawUI() {
int ui_track = 0; int ui_track = 0;
if (playMode == MODE_POLY) { if (playMode == MODE_POLY) {
if (currentState == UI_MENU_RANDOMIZE || currentState == UI_EDIT_FLAVOUR || currentState == UI_EDIT_TEMPO || currentState == UI_RANDOMIZE_TRACK_EDIT) { ui_track = randomizeTrack;
ui_track = randomizeTrack;
} else { // UI_TRACKER, UI_MENU_SETUP, UI_SETUP_CHANNEL_EDIT etc.
ui_track = currentTrack;
}
} }
ui.draw(currentState, menuSelection, navigationSelection, editMode, ui.draw(currentState, menuSelection,
midiChannels[ui_track], tempo, strategies[currentStrategyIndices[ui_track]], midiChannels[ui_track], tempo, strategies[currentStrategyIndices[ui_track]],
queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeeds[ui_track], queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeeds[ui_track],
mutationEnabled, songModeEnabled, sequence, scrollOffset, playbackStep, isPlaying, mutationEnabled, songModeEnabled, sequence, playbackStep, isPlaying,
mainMenu, mainMenuCount, randMenu, randMenuCount, setupMenu, setupMenuCount, mainMenu, mainMenuCount, randMenu, randMenuCount, setupMenu, setupMenuCount,
themeIndex, playMode, currentTrack, randomizeTrack, (const bool*)trackMute); themeIndex, playMode, randomizeTrack, (const bool*)trackMute);
midi.unlock(); midi.unlock();
} }
void updateLeds() { void updateLeds() {
midi.lock(); midi.lock();
ui.updateLeds(sequence, navigationSelection, playbackStep, isPlaying, currentState, editMode, songModeEnabled, songRepeatsRemaining, sequenceChangeScheduled, playMode, currentTrack, numScaleNotes, scaleNotes, (const bool*)trackMute); ui.updateLeds(sequence, playbackStep, isPlaying, currentState, songModeEnabled, songRepeatsRemaining, sequenceChangeScheduled, playMode, numScaleNotes, scaleNotes, (const bool*)trackMute);
midi.unlock(); midi.unlock();
} }

View File

@ -15,14 +15,7 @@ enum PlayMode {
MODE_POLY MODE_POLY
}; };
enum EditMode {
NAV_STEP,
NAV_TRACK,
EDIT_NOTE
};
enum UIState { enum UIState {
UI_TRACKER,
UI_MENU_MAIN, UI_MENU_MAIN,
UI_MENU_RANDOMIZE, UI_MENU_RANDOMIZE,
UI_MENU_SETUP, UI_MENU_SETUP,

View File

@ -45,16 +45,16 @@ void UIManager::showMessage(const char* msg) {
display.setTextSize(1); display.setTextSize(1);
} }
void UIManager::draw(UIState currentState, int menuSelection, int navSelection, EditMode editMode, void UIManager::draw(UIState currentState, int menuSelection,
int midiChannel, int tempo, MelodyStrategy* currentStrategy, int midiChannel, int tempo, MelodyStrategy* currentStrategy,
int queuedTheme, int currentThemeIndex, int queuedTheme, int currentThemeIndex,
int numScaleNotes, const int* scaleNotes, int melodySeed, int numScaleNotes, const int* scaleNotes, int melodySeed,
bool mutationEnabled, bool songModeEnabled, bool mutationEnabled, bool songModeEnabled,
const Step sequence[][NUM_STEPS], int scrollOffset, int playbackStep, bool isPlaying, const Step sequence[][NUM_STEPS], int playbackStep, bool isPlaying,
const char* mainMenu[], int mainMenuCount, const char* mainMenu[], int mainMenuCount,
const char* randomizeMenu[], int randomizeMenuCount, const char* randomizeMenu[], int randomizeMenuCount,
const char* setupMenu[], int setupMenuCount, int theme1Index, const char* setupMenu[], int setupMenuCount, int theme1Index,
PlayMode playMode, int currentTrack, int randomizeTrack, const bool* trackMute) { PlayMode playMode, int randomizeTrack, const bool* trackMute) {
display.clearDisplay(); display.clearDisplay();
display.setTextSize(1); display.setTextSize(1);
@ -62,14 +62,11 @@ void UIManager::draw(UIState currentState, int menuSelection, int navSelection,
display.setCursor(0, 0); display.setCursor(0, 0);
switch(currentState) { switch(currentState) {
case UI_TRACKER:
drawTracker(navSelection, editMode, midiChannel, sequence, scrollOffset, playbackStep, isPlaying, playMode, currentTrack);
break;
case UI_MENU_MAIN: case UI_MENU_MAIN:
drawMenu("MAIN MENU", mainMenu, mainMenuCount, menuSelection, currentState, midiChannel, tempo, currentStrategy->getName(), queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeed, mutationEnabled, songModeEnabled, theme1Index, playMode, randomizeTrack, trackMute); drawMenu("MAIN MENU", mainMenu, mainMenuCount, menuSelection, currentState, midiChannel, tempo, currentStrategy->getName(), queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeed, mutationEnabled, songModeEnabled, theme1Index, playMode, randomizeTrack, trackMute);
break; break;
case UI_MENU_RANDOMIZE: case UI_MENU_RANDOMIZE:
drawMenu("RANDOMIZE", randomizeMenu, randomizeMenuCount, menuSelection, currentState, midiChannel, tempo, currentStrategy->getName(), queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeed, mutationEnabled, songModeEnabled, theme1Index, playMode, randomizeTrack, trackMute); drawMenu("PLAY", randomizeMenu, randomizeMenuCount, menuSelection, currentState, midiChannel, tempo, currentStrategy->getName(), queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeed, mutationEnabled, songModeEnabled, theme1Index, playMode, randomizeTrack, trackMute);
break; break;
case UI_MENU_SETUP: case UI_MENU_SETUP:
drawMenu("SETUP", setupMenu, setupMenuCount, menuSelection, currentState, midiChannel, tempo, currentStrategy->getName(), queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeed, mutationEnabled, songModeEnabled, theme1Index, playMode, randomizeTrack, trackMute); drawMenu("SETUP", setupMenu, setupMenuCount, menuSelection, currentState, midiChannel, tempo, currentStrategy->getName(), queuedTheme, currentThemeIndex, numScaleNotes, scaleNotes, melodySeed, mutationEnabled, songModeEnabled, theme1Index, playMode, randomizeTrack, trackMute);
@ -197,81 +194,6 @@ void UIManager::drawMenu(const char* title, const char* items[], int count, int
} }
} }
void UIManager::drawTracker(int navSelection, EditMode editMode, int midiChannel,
const Step sequence[][NUM_STEPS], int scrollOffset, int playbackStep, bool isPlaying,
PlayMode playMode, int currentTrack) {
display.print(F("SEQ "));
if (playMode == MODE_POLY) {
switch(editMode) {
case NAV_STEP: display.print(F("[STP]")); break;
case NAV_TRACK: display.print(F("[TRK]")); break;
case EDIT_NOTE: display.print(F("[EDT]")); break;
}
} else {
if (navSelection > 0 && editMode == EDIT_NOTE) display.print(F("[EDT]"));
else display.print(F("[NAV]"));
}
display.print(F(" CH:")); display.print(midiChannel);
display.println();
display.drawLine(0, 8, 128, 8, SSD1306_WHITE);
int y = 10;
for (int i = 0; i < 6; i++) {
int itemIndex = i + scrollOffset;
if (itemIndex > NUM_STEPS) break;
if (itemIndex == navSelection && editMode != NAV_TRACK) {
display.fillRect(0, y, 128, 8, SSD1306_WHITE);
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE);
} else {
display.setTextColor(SSD1306_WHITE);
}
display.setCursor(2, y);
if (itemIndex == 0) {
display.print(F(">> MENU"));
} else {
int stepIndex = itemIndex - 1;
bool isPlayback = isPlaying && (stepIndex == playbackStep);
if (isPlayback && editMode != NAV_TRACK) {
if (itemIndex == navSelection) display.setTextColor(SSD1306_WHITE, SSD1306_BLACK); // Cursor on playback row
else display.setTextColor(SSD1306_BLACK, SSD1306_WHITE);
}
if (stepIndex < 10) display.print(F("0"));
display.print(stepIndex);
if (isPlayback && editMode != NAV_TRACK) {
if (itemIndex == navSelection) display.setTextColor(SSD1306_BLACK, SSD1306_WHITE);
else display.setTextColor(SSD1306_WHITE);
}
display.print(F(" | "));
int tracksToShow = (playMode == MODE_POLY) ? NUM_TRACKS : 1;
for(int t=0; t<tracksToShow; t++) {
if (playMode == MODE_POLY && t == currentTrack && (editMode == NAV_TRACK || (editMode == EDIT_NOTE && itemIndex == navSelection))) {
display.fillRect(display.getCursorX(), y, 28, 8, SSD1306_WHITE);
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE);
} else if (itemIndex == navSelection && editMode != NAV_TRACK) {
display.setTextColor(SSD1306_BLACK, SSD1306_WHITE);
} else {
display.setTextColor(SSD1306_WHITE);
}
int n = sequence[t][stepIndex].note;
if (n == -1) {
display.print(F(" ---"));
} else {
const char* noteNames[] = {"C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-"};
display.print(noteNames[n % 12]);
display.print(n / 12 - 1);
}
display.print(" ");
}
}
y += 9;
}
}
uint32_t UIManager::getNoteColor(int note, bool dim) { uint32_t UIManager::getNoteColor(int note, bool dim) {
if (note == -1) return 0; if (note == -1) return 0;
uint16_t hue = 30000 + (note % 12) * 3628; uint16_t hue = 30000 + (note % 12) * 3628;
@ -282,9 +204,9 @@ int UIManager::getPixelIndex(int x, int y) {
return y * 8 + x; return y * 8 + x;
} }
void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int navSelection, int playbackStep, bool isPlaying, void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int playbackStep, bool isPlaying,
UIState currentState, EditMode editMode, bool songModeEnabled, UIState currentState, bool songModeEnabled,
int songRepeatsRemaining, bool sequenceChangeScheduled, PlayMode playMode, int currentTrack, int songRepeatsRemaining, bool sequenceChangeScheduled, PlayMode playMode,
int numScaleNotes, const int* scaleNotes, const bool* trackMute) { int numScaleNotes, const int* scaleNotes, const bool* trackMute) {
pixels.clear(); pixels.clear();
@ -313,8 +235,6 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int navSelection, i
} else { } else {
color = (note != -1) ? COLOR_PLAYHEAD : COLOR_PLAYHEAD_DIM; color = (note != -1) ? COLOR_PLAYHEAD : COLOR_PLAYHEAD_DIM;
} }
} else if (!isPlaying && currentState == UI_TRACKER && (navSelection - 1) == s && currentTrack == t) {
color = (note != -1) ? COLOR_CURSOR : COLOR_CURSOR_DIM;
} }
pixels.setPixelColor(getPixelIndex(col, row), color); pixels.setPixelColor(getPixelIndex(col, row), color);
@ -337,7 +257,6 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int navSelection, i
else if (octave < 4) { c[2] = color; if (sequence[0][s].accent) c[1] = dimColor; } else if (octave < 4) { c[2] = color; if (sequence[0][s].accent) c[1] = dimColor; }
else { c[1] = color; if (sequence[0][s].accent) { c[0] = dimColor; c[2] = dimColor; } } else { c[1] = color; if (sequence[0][s].accent) { c[0] = dimColor; c[2] = dimColor; } }
} }
int stepNavIndex = navSelection - 1;
uint32_t cursorColor = 0; uint32_t cursorColor = 0;
if (isPlaying) { if (isPlaying) {
cursorColor = pixels.Color(0, 50, 0); cursorColor = pixels.Color(0, 50, 0);
@ -345,11 +264,9 @@ void UIManager::updateLeds(const Step sequence[][NUM_STEPS], int navSelection, i
int repeats = min(songRepeatsRemaining, 8); int repeats = min(songRepeatsRemaining, 8);
if (x >= (8 - repeats)) cursorColor = (songRepeatsRemaining == 1 && x == 7 && (millis()/250)%2) ? pixels.Color(255, 200, 0) : pixels.Color(100, 220, 40); if (x >= (8 - repeats)) cursorColor = (songRepeatsRemaining == 1 && x == 7 && (millis()/250)%2) ? pixels.Color(255, 200, 0) : pixels.Color(100, 220, 40);
} }
} else if (currentState == UI_TRACKER) {
cursorColor = (editMode == EDIT_NOTE) ? pixels.Color(50, 0, 0) : pixels.Color(40, 40, 40);
} }
bool isCursorHere = (isPlaying && s == playbackStep) || (!isPlaying && currentState == UI_TRACKER && s == stepNavIndex); bool isCursorHere = (isPlaying && s == playbackStep);
if (cursorColor != 0) { if (cursorColor != 0) {
if (isCursorHere) c[3] = cursorColor; if (isCursorHere) c[3] = cursorColor;
else { else {

View File

@ -14,20 +14,20 @@ public:
void showMessage(const char* msg); void showMessage(const char* msg);
void draw(UIState currentState, int menuSelection, int navSelection, EditMode editMode, void draw(UIState currentState, int menuSelection,
int midiChannel, int tempo, MelodyStrategy* currentStrategy, int midiChannel, int tempo, MelodyStrategy* currentStrategy,
int queuedTheme, int currentThemeIndex, int queuedTheme, int currentThemeIndex,
int numScaleNotes, const int* scaleNotes, int melodySeed, int numScaleNotes, const int* scaleNotes, int melodySeed,
bool mutationEnabled, bool songModeEnabled, bool mutationEnabled, bool songModeEnabled,
const Step sequence[][NUM_STEPS], int scrollOffset, int playbackStep, bool isPlaying, const Step sequence[][NUM_STEPS], int playbackStep, bool isPlaying,
const char* mainMenu[], int mainMenuCount, const char* mainMenu[], int mainMenuCount,
const char* randomizeMenu[], int randomizeMenuCount, const char* randomizeMenu[], int randomizeMenuCount,
const char* setupMenu[], int setupMenuCount, int theme1Index, const char* setupMenu[], int setupMenuCount, int theme1Index,
PlayMode playMode, int currentTrack, int randomizeTrack, const bool* trackMute); PlayMode playMode, int randomizeTrack, const bool* trackMute);
void updateLeds(const Step sequence[][NUM_STEPS], int navSelection, int playbackStep, bool isPlaying, void updateLeds(const Step sequence[][NUM_STEPS], int playbackStep, bool isPlaying,
UIState currentState, EditMode editMode, bool songModeEnabled, UIState currentState, bool songModeEnabled,
int songRepeatsRemaining, bool sequenceChangeScheduled, PlayMode playMode, int currentTrack, int songRepeatsRemaining, bool sequenceChangeScheduled, PlayMode playMode,
int numScaleNotes, const int* scaleNotes, const bool* trackMute); int numScaleNotes, const int* scaleNotes, const bool* trackMute);
private: private:
@ -41,10 +41,6 @@ private:
int numScaleNotes, const int* scaleNotes, int melodySeed, int numScaleNotes, const int* scaleNotes, int melodySeed,
bool mutationEnabled, bool songModeEnabled, int theme1Index, PlayMode playMode, int randomizeTrack, const bool* trackMute); bool mutationEnabled, bool songModeEnabled, int theme1Index, PlayMode playMode, int randomizeTrack, const bool* trackMute);
void drawTracker(int navSelection, EditMode editMode, int midiChannel,
const Step sequence[][NUM_STEPS], int scrollOffset, int playbackStep, bool isPlaying,
PlayMode playMode, int currentTrack);
uint32_t getNoteColor(int note, bool dim); uint32_t getNoteColor(int note, bool dim);
int getPixelIndex(int x, int y); int getPixelIndex(int x, int y);
}; };