Skip to content

Commit

Permalink
Fix kit shortcut blinks (SynthstromAudible#2073)
Browse files Browse the repository at this point in the history
* soundeditor: only use global kit param table when actually setting up global param

* soundeditor: Share logic for shortcut blink setup

* soundeditor: add missing return in shortcut setup
  • Loading branch information
sapphire-arches committed Jun 3, 2024
1 parent e5b836b commit be24370
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 54 deletions.
72 changes: 18 additions & 54 deletions src/deluge/gui/ui/sound_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,18 @@ void SoundEditor::updateSourceBlinks(MenuItem* currentItem) {
}
}

void SoundEditor::setupShortcutsBlinkFromTable(MenuItem const* const currentItem,
MenuItem const* const items[kDisplayWidth][kDisplayHeight]) {
for (auto x = 0; x < 15; ++x) {
for (auto y = 0; y < kDisplayHeight; ++y) {
if (items[x][y] == currentItem) {
setupShortcutBlink(x, y, 0);
return;
}
}
}
}

bool SoundEditor::beginScreen(MenuItem* oldMenuItem) {

MenuItem* currentItem = getCurrentMenuItem();
Expand Down Expand Up @@ -587,66 +599,19 @@ bool SoundEditor::beginScreen(MenuItem* oldMenuItem) {
// Find param shortcut
currentParamShorcutX = 255;

// Global song parameters (this check seems very sketchy...)
if (!rootUIIsClipMinderScreen()) {
int32_t x, y;

// First, see if there's a shortcut for the actual MenuItem we're currently on
for (x = 0; x < 15; x++) {
for (y = 0; y < kDisplayHeight; y++) {
if (paramShortcutsForSongView[x][y] == currentItem) {
goto doSetupBlinkingForSessionView;
}
}
}

if (false) {
doSetupBlinkingForSessionView:
setupShortcutBlink(x, y, 0);
}
setupShortcutsBlinkFromTable(currentItem, paramShortcutsForSongView);
}

// For Kit Instrument Clip with Affect Entire Enabled
else if ((getCurrentOutputType() == OutputType::KIT) && (getCurrentInstrumentClip()->affectEntire)) {

int32_t x, y;

// First, see if there's a shortcut for the actual MenuItem we're currently on
for (x = 0; x < 15; x++) {
for (y = 0; y < kDisplayHeight; y++) {
if (paramShortcutsForKitGlobalFX[x][y] == currentItem) {
goto doSetupBlinkingForKitGlobalFX;
}
}
}

if (false) {
doSetupBlinkingForKitGlobalFX:
setupShortcutBlink(x, y, 0);
}
else if ((getCurrentOutputType() == OutputType::KIT) && (getCurrentInstrumentClip()->affectEntire)
&& setupKitGlobalFXMenu) {
setupShortcutsBlinkFromTable(currentItem, paramShortcutsForKitGlobalFX);
}

// For AudioClips...
else if (getCurrentClip()->type == ClipType::AUDIO) {

int32_t x, y;

// First, see if there's a shortcut for the actual MenuItem we're currently on
for (x = 0; x < 15; x++) {
for (y = 0; y < kDisplayHeight; y++) {
if (paramShortcutsForAudioClips[x][y] == currentItem) {
// if (x == 10 && y < 6 && editingReverbSidechain()) goto stopThat;
// if (currentParamShorcutX != 255 && (x & 1) && currentSourceIndex == 0) goto stopThat;
goto doSetupBlinkingForAudioClip;
}
}
}

if (false) {
doSetupBlinkingForAudioClip:
setupShortcutBlink(x, y, 0);
}
setupShortcutsBlinkFromTable(currentItem, paramShortcutsForAudioClips);
}

// Or for MIDI or CV clips
else if (editingCVOrMIDIClip()) {
for (int32_t y = 0; y < kDisplayHeight; y++) {
Expand All @@ -656,7 +621,6 @@ bool SoundEditor::beginScreen(MenuItem* oldMenuItem) {
}
}
}

// Or the "normal" case, for Sounds
else {

Expand Down
3 changes: 3 additions & 0 deletions src/deluge/gui/ui/sound_editor.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ class SoundEditor final : public UI {
bool selectedNoteRow;

private:
/// Setup shortcut blinking by finding the given menu item in the provided item map
void setupShortcutsBlinkFromTable(MenuItem const* currentItem,
MenuItem const* const items[kDisplayWidth][kDisplayHeight]);
bool beginScreen(MenuItem* oldMenuItem = NULL);
uint8_t getActualParamFromScreen(uint8_t screen);
void setLedStates();
Expand Down

0 comments on commit be24370

Please sign in to comment.