From 895170a4f751c2bf3e725e1cc85c18d943b623f2 Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Mon, 2 Jun 2025 23:18:39 +0200 Subject: [PATCH 01/10] implement jumpToNextSection in PhraseView for notes column --- sources/Application/Model/Phrase.cpp | 4 +- sources/Application/Model/Phrase.h | 2 + sources/Application/Views/PhraseView.cpp | 55 +++++++++++++++++++++++- sources/Application/Views/PhraseView.h | 2 + 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/sources/Application/Model/Phrase.cpp b/sources/Application/Model/Phrase.cpp index 0e7a5f8bd..1b2b3de35 100644 --- a/sources/Application/Model/Phrase.cpp +++ b/sources/Application/Model/Phrase.cpp @@ -5,8 +5,8 @@ Phrase::Phrase() { for (int i = 0; i < PHRASE_COUNT * 16; i++) { - note_[i] = 0xFF; - instr_[i] = 0xFF; + note_[i] = NO_NOTE_ASSIGNED; + instr_[i] = NO_INSTRUMENT_ASSIGNED; cmd1_[i] = FourCC::InstrumentCommandNone; param1_[i] = 0x00; cmd2_[i] = FourCC::InstrumentCommandNone; diff --git a/sources/Application/Model/Phrase.h b/sources/Application/Model/Phrase.h index 0fc5e3ddf..d6e0ea268 100644 --- a/sources/Application/Model/Phrase.h +++ b/sources/Application/Model/Phrase.h @@ -4,6 +4,8 @@ #include "Foundation/Types/Types.h" #define PHRASE_COUNT 0x80 #define NO_MORE_PHRASE 0x81 +#define NO_NOTE_ASSIGNED 0xFF +#define NO_INSTRUMENT_ASSIGNED 0xFF class Phrase { public: diff --git a/sources/Application/Views/PhraseView.cpp b/sources/Application/Views/PhraseView.cpp index 6139ee27f..773e1000c 100644 --- a/sources/Application/Views/PhraseView.cpp +++ b/sources/Application/Views/PhraseView.cpp @@ -328,6 +328,54 @@ void PhraseView::pasteLast() { } } +void PhraseView::jumpToNextSection(int direction) { + if (col_ == 0) { + int phraseStart = viewData_->currentPhrase_ * 16; + int current = row_; + // uchar note = phrase_->note_[phraseStart + row_]; + constexpr int PHRASE_ROW_COUNT = 16; + bool foundGap = false; + for (int i = 0; i < PHRASE_ROW_COUNT; i++) { + uchar note = phrase_->note_[phraseStart + current]; + if (foundGap && note != NO_NOTE_ASSIGNED){ + break; + } else { + if (note == 0xFF) { + foundGap = true; + } + } + current += direction; + if (current < 0) { + current += PHRASE_ROW_COUNT; + } + if (current >= PHRASE_ROW_COUNT) { + current -= PHRASE_ROW_COUNT; + } + } + + /* + if (direction < 0) { + while (current > 0) { + uchar note = phrase_->note_[phraseStart + current]; + if (note == 0xFF) { + current++; + break; + } else { + current--; + } + } + } + */ + // update viewdata position from current + Trace::Debug("jumpToNextSection: to %d", current); + row_ = current; + isDirty_ = true; + } + else { + Trace::Log("PHRASEVIEW", "jumpToNextSection for col %d not implemented", col_); + } +} + void PhraseView::cutPosition() { clipboard_.active_ = true; @@ -964,7 +1012,12 @@ void PhraseView::processNormalButtonMask(unsigned short mask) { } else { // L Modifier if (mask & EPBM_ALT) { - + if (mask & EPBM_DOWN) { + jumpToNextSection(1); + } + if (mask & EPBM_UP) { + jumpToNextSection(-1); + } } else { // No modifier diff --git a/sources/Application/Views/PhraseView.h b/sources/Application/Views/PhraseView.h index 4acc06424..939e3f5d1 100644 --- a/sources/Application/Views/PhraseView.h +++ b/sources/Application/Views/PhraseView.h @@ -27,6 +27,8 @@ class PhraseView : public ScreenView { void cutPosition(); void pasteLast(); + void jumpToNextSection(int dir); + void extendSelection(); GUIRect getSelectionRect(); From 70a4c5eb00a4e57efafabbbe95ce210a7a96fac9 Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Mon, 2 Jun 2025 23:27:10 +0200 Subject: [PATCH 02/10] format PhraseView --- sources/Application/Views/PhraseView.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/Application/Views/PhraseView.cpp b/sources/Application/Views/PhraseView.cpp index 773e1000c..87eadab75 100644 --- a/sources/Application/Views/PhraseView.cpp +++ b/sources/Application/Views/PhraseView.cpp @@ -337,7 +337,7 @@ void PhraseView::jumpToNextSection(int direction) { bool foundGap = false; for (int i = 0; i < PHRASE_ROW_COUNT; i++) { uchar note = phrase_->note_[phraseStart + current]; - if (foundGap && note != NO_NOTE_ASSIGNED){ + if (foundGap && note != NO_NOTE_ASSIGNED) { break; } else { if (note == 0xFF) { @@ -370,9 +370,9 @@ void PhraseView::jumpToNextSection(int direction) { Trace::Debug("jumpToNextSection: to %d", current); row_ = current; isDirty_ = true; - } - else { - Trace::Log("PHRASEVIEW", "jumpToNextSection for col %d not implemented", col_); + } else { + Trace::Log("PHRASEVIEW", "jumpToNextSection for col %d not implemented", + col_); } } From d3ac7d683e3e49101a604dfe8f2f1613f417f01d Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Mon, 2 Jun 2025 23:37:30 +0200 Subject: [PATCH 03/10] handle instrument column for PhraseView::jumpToNextSection --- sources/Application/Views/PhraseView.cpp | 39 ++++++++++++++++-------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/sources/Application/Views/PhraseView.cpp b/sources/Application/Views/PhraseView.cpp index 87eadab75..c941c957e 100644 --- a/sources/Application/Views/PhraseView.cpp +++ b/sources/Application/Views/PhraseView.cpp @@ -329,10 +329,9 @@ void PhraseView::pasteLast() { } void PhraseView::jumpToNextSection(int direction) { - if (col_ == 0) { + if (col_ == 0) { // Note Column int phraseStart = viewData_->currentPhrase_ * 16; int current = row_; - // uchar note = phrase_->note_[phraseStart + row_]; constexpr int PHRASE_ROW_COUNT = 16; bool foundGap = false; for (int i = 0; i < PHRASE_ROW_COUNT; i++) { @@ -340,7 +339,7 @@ void PhraseView::jumpToNextSection(int direction) { if (foundGap && note != NO_NOTE_ASSIGNED) { break; } else { - if (note == 0xFF) { + if (note == NO_NOTE_ASSIGNED) { foundGap = true; } } @@ -353,19 +352,33 @@ void PhraseView::jumpToNextSection(int direction) { } } - /* - if (direction < 0) { - while (current > 0) { - uchar note = phrase_->note_[phraseStart + current]; - if (note == 0xFF) { - current++; - break; - } else { - current--; + // update viewdata position from current + Trace::Debug("jumpToNextSection: to %d", current); + row_ = current; + isDirty_ = true; + } else if (col_ == 1) { // Instrument Column + int phraseStart = viewData_->currentPhrase_ * 16; + int current = row_; + constexpr int PHRASE_ROW_COUNT = 16; + bool foundGap = false; + for (int i = 0; i < PHRASE_ROW_COUNT; i++) { + uchar instrument = phrase_->instr_[phraseStart + current]; + if (foundGap && instrument != NO_NOTE_ASSIGNED) { + break; + } else { + if (instrument == NO_INSTRUMENT_ASSIGNED) { + foundGap = true; } } + current += direction; + if (current < 0) { + current += PHRASE_ROW_COUNT; + } + if (current >= PHRASE_ROW_COUNT) { + current -= PHRASE_ROW_COUNT; + } } - */ + // update viewdata position from current Trace::Debug("jumpToNextSection: to %d", current); row_ = current; From c8ae26b60a12700f5abe494873824a6057cf070b Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Mon, 2 Jun 2025 23:45:23 +0200 Subject: [PATCH 04/10] handle command1 column for PhraseView::jumpToNextSection --- sources/Application/Views/PhraseView.cpp | 27 ++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sources/Application/Views/PhraseView.cpp b/sources/Application/Views/PhraseView.cpp index c941c957e..4290ec2b5 100644 --- a/sources/Application/Views/PhraseView.cpp +++ b/sources/Application/Views/PhraseView.cpp @@ -379,6 +379,33 @@ void PhraseView::jumpToNextSection(int direction) { } } + // update viewdata position from current + Trace::Debug("jumpToNextSection: to %d", current); + row_ = current; + isDirty_ = true; + } else if (col_ == 2) { // Command1 Column + int phraseStart = viewData_->currentPhrase_ * 16; + int current = row_; + constexpr int PHRASE_ROW_COUNT = 16; + bool foundGap = false; + for (int i = 0; i < PHRASE_ROW_COUNT; i++) { + FourCC instrument = phrase_->cmd1_[phraseStart + current]; + if (foundGap && instrument != FourCC::InstrumentCommandNone) { + break; + } else { + if (instrument == FourCC::InstrumentCommandNone) { + foundGap = true; + } + } + current += direction; + if (current < 0) { + current += PHRASE_ROW_COUNT; + } + if (current >= PHRASE_ROW_COUNT) { + current -= PHRASE_ROW_COUNT; + } + } + // update viewdata position from current Trace::Debug("jumpToNextSection: to %d", current); row_ = current; From cf4c613ce5058cc2a1f6ca8e26b57b5df562a25b Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Tue, 3 Jun 2025 00:03:07 +0200 Subject: [PATCH 05/10] implement PhraseView::jumpToNextSection for all columns --- sources/Application/Model/Phrase.cpp | 2 +- sources/Application/Model/Phrase.h | 13 +- sources/Application/Views/PhraseView.cpp | 148 ++++++++++++++--------- 3 files changed, 102 insertions(+), 61 deletions(-) diff --git a/sources/Application/Model/Phrase.cpp b/sources/Application/Model/Phrase.cpp index 1b2b3de35..70f90b4f9 100644 --- a/sources/Application/Model/Phrase.cpp +++ b/sources/Application/Model/Phrase.cpp @@ -4,7 +4,7 @@ #include Phrase::Phrase() { - for (int i = 0; i < PHRASE_COUNT * 16; i++) { + for (int i = 0; i < PHRASE_COUNT * PHRASE_ROW_COUNT; i++) { note_[i] = NO_NOTE_ASSIGNED; instr_[i] = NO_INSTRUMENT_ASSIGNED; cmd1_[i] = FourCC::InstrumentCommandNone; diff --git a/sources/Application/Model/Phrase.h b/sources/Application/Model/Phrase.h index d6e0ea268..7a40f3d3f 100644 --- a/sources/Application/Model/Phrase.h +++ b/sources/Application/Model/Phrase.h @@ -4,6 +4,7 @@ #include "Foundation/Types/Types.h" #define PHRASE_COUNT 0x80 #define NO_MORE_PHRASE 0x81 +#define PHRASE_ROW_COUNT 16 #define NO_NOTE_ASSIGNED 0xFF #define NO_INSTRUMENT_ASSIGNED 0xFF @@ -16,12 +17,12 @@ class Phrase { void SetUsed(uchar c); void ClearAllocation(); - uchar note_[PHRASE_COUNT * 16]; - uchar instr_[PHRASE_COUNT * 16]; - FourCC cmd1_[PHRASE_COUNT * 16]; - ushort param1_[PHRASE_COUNT * 16]; - FourCC cmd2_[PHRASE_COUNT * 16]; - ushort param2_[PHRASE_COUNT * 16]; + uchar note_[PHRASE_COUNT * PHRASE_ROW_COUNT]; + uchar instr_[PHRASE_COUNT * PHRASE_ROW_COUNT]; + FourCC cmd1_[PHRASE_COUNT * PHRASE_ROW_COUNT]; + ushort param1_[PHRASE_COUNT * PHRASE_ROW_COUNT]; + FourCC cmd2_[PHRASE_COUNT * PHRASE_ROW_COUNT]; + ushort param2_[PHRASE_COUNT * PHRASE_ROW_COUNT]; private: bool isUsed_[PHRASE_COUNT]; diff --git a/sources/Application/Views/PhraseView.cpp b/sources/Application/Views/PhraseView.cpp index 4290ec2b5..26adee399 100644 --- a/sources/Application/Views/PhraseView.cpp +++ b/sources/Application/Views/PhraseView.cpp @@ -329,91 +329,131 @@ void PhraseView::pasteLast() { } void PhraseView::jumpToNextSection(int direction) { - if (col_ == 0) { // Note Column - int phraseStart = viewData_->currentPhrase_ * 16; - int current = row_; - constexpr int PHRASE_ROW_COUNT = 16; - bool foundGap = false; + int phraseStart = viewData_->currentPhrase_ * PHRASE_ROW_COUNT; + int current = row_; + bool foundGap = false; + + // Find a gap and then find non-gap item in the chosen direction + switch (col_) { + // Note column + case 0: { for (int i = 0; i < PHRASE_ROW_COUNT; i++) { uchar note = phrase_->note_[phraseStart + current]; if (foundGap && note != NO_NOTE_ASSIGNED) { break; - } else { - if (note == NO_NOTE_ASSIGNED) { - foundGap = true; - } + } else if (note == NO_NOTE_ASSIGNED) { + foundGap = true; } current += direction; - if (current < 0) { + if (current < 0) current += PHRASE_ROW_COUNT; - } - if (current >= PHRASE_ROW_COUNT) { + if (current >= PHRASE_ROW_COUNT) current -= PHRASE_ROW_COUNT; - } } + break; + } - // update viewdata position from current - Trace::Debug("jumpToNextSection: to %d", current); - row_ = current; - isDirty_ = true; - } else if (col_ == 1) { // Instrument Column - int phraseStart = viewData_->currentPhrase_ * 16; - int current = row_; - constexpr int PHRASE_ROW_COUNT = 16; - bool foundGap = false; + // Instrument column + case 1: { for (int i = 0; i < PHRASE_ROW_COUNT; i++) { uchar instrument = phrase_->instr_[phraseStart + current]; - if (foundGap && instrument != NO_NOTE_ASSIGNED) { + if (foundGap && instrument != NO_INSTRUMENT_ASSIGNED) { break; - } else { - if (instrument == NO_INSTRUMENT_ASSIGNED) { - foundGap = true; - } + } else if (instrument == NO_INSTRUMENT_ASSIGNED) { + foundGap = true; } current += direction; - if (current < 0) { + if (current < 0) current += PHRASE_ROW_COUNT; - } - if (current >= PHRASE_ROW_COUNT) { + if (current >= PHRASE_ROW_COUNT) current -= PHRASE_ROW_COUNT; + } + break; + } + + // Command1 column + case 2: { + for (int i = 0; i < PHRASE_ROW_COUNT; i++) { + FourCC command = phrase_->cmd1_[phraseStart + current]; + if (foundGap && command != FourCC::InstrumentCommandNone) { + break; + } else if (command == FourCC::InstrumentCommandNone) { + foundGap = true; } + current += direction; + if (current < 0) + current += PHRASE_ROW_COUNT; + if (current >= PHRASE_ROW_COUNT) + current -= PHRASE_ROW_COUNT; } + break; + } - // update viewdata position from current - Trace::Debug("jumpToNextSection: to %d", current); - row_ = current; - isDirty_ = true; - } else if (col_ == 2) { // Command1 Column - int phraseStart = viewData_->currentPhrase_ * 16; - int current = row_; - constexpr int PHRASE_ROW_COUNT = 16; - bool foundGap = false; + // Param1 column + case 3: { for (int i = 0; i < PHRASE_ROW_COUNT; i++) { - FourCC instrument = phrase_->cmd1_[phraseStart + current]; - if (foundGap && instrument != FourCC::InstrumentCommandNone) { + ushort param = phrase_->param1_[phraseStart + current]; + if (foundGap && param != 0) { break; - } else { - if (instrument == FourCC::InstrumentCommandNone) { - foundGap = true; - } + } else if (param == 0) { + foundGap = true; } current += direction; - if (current < 0) { + if (current < 0) current += PHRASE_ROW_COUNT; + if (current >= PHRASE_ROW_COUNT) + current -= PHRASE_ROW_COUNT; + } + break; + } + + // Command2 column + case 4: { + for (int i = 0; i < PHRASE_ROW_COUNT; i++) { + FourCC command = phrase_->cmd2_[phraseStart + current]; + if (foundGap && command != FourCC::InstrumentCommandNone) { + break; + } else if (command == FourCC::InstrumentCommandNone) { + foundGap = true; } - if (current >= PHRASE_ROW_COUNT) { + current += direction; + if (current < 0) + current += PHRASE_ROW_COUNT; + if (current >= PHRASE_ROW_COUNT) current -= PHRASE_ROW_COUNT; + } + break; + } + + // Param2 column + case 5: { + for (int i = 0; i < PHRASE_ROW_COUNT; i++) { + ushort param = phrase_->param2_[phraseStart + current]; + if (foundGap && param != 0) { + break; + } else if (param == 0) { + foundGap = true; } + current += direction; + if (current < 0) + current += PHRASE_ROW_COUNT; + if (current >= PHRASE_ROW_COUNT) + current -= PHRASE_ROW_COUNT; } + break; + } - // update viewdata position from current - Trace::Debug("jumpToNextSection: to %d", current); - row_ = current; - isDirty_ = true; - } else { - Trace::Log("PHRASEVIEW", "jumpToNextSection for col %d not implemented", - col_); + default: { + Trace::Error("PHRASEVIEW: jumpToNextSection received unexpected value for " + "col %d not implemented", + col_); + return; } + } + + // update view + row_ = current; + isDirty_ = true; } void PhraseView::cutPosition() { From 085d8e8ceabc674b09793a92bdb6a47d65bfc312 Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Tue, 3 Jun 2025 00:23:17 +0200 Subject: [PATCH 06/10] update project number & build count --- sources/Application/Model/BuildNumber.h | 2 +- sources/Application/Model/Project.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/Application/Model/BuildNumber.h b/sources/Application/Model/BuildNumber.h index f71379db5..b2ec4b71f 100644 --- a/sources/Application/Model/BuildNumber.h +++ b/sources/Application/Model/BuildNumber.h @@ -1 +1 @@ -#define BUILD_COUNT "003" +#define BUILD_COUNT "001" diff --git a/sources/Application/Model/Project.h b/sources/Application/Model/Project.h index 9207da5c7..df99daf22 100644 --- a/sources/Application/Model/Project.h +++ b/sources/Application/Model/Project.h @@ -10,7 +10,7 @@ #include "Foundation/Variables/VariableContainer.h" #include "Song.h" -#define PROJECT_NUMBER "2.1-BETA1" +#define PROJECT_NUMBER "2.1-JumpSection" #define PROJECT_RELEASE "r" // BUILD_COUNT define comes from BuildNumber.h From e937e705faff18ba4a13dfd2a87995166b9cdbc8 Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Tue, 3 Jun 2025 08:16:09 +0200 Subject: [PATCH 07/10] Revert "update project number & build count" This reverts commit 085d8e8ceabc674b09793a92bdb6a47d65bfc312. Project number & build count are being set in GitHub Actions. --- sources/Application/Model/BuildNumber.h | 2 +- sources/Application/Model/Project.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sources/Application/Model/BuildNumber.h b/sources/Application/Model/BuildNumber.h index b2ec4b71f..f71379db5 100644 --- a/sources/Application/Model/BuildNumber.h +++ b/sources/Application/Model/BuildNumber.h @@ -1 +1 @@ -#define BUILD_COUNT "001" +#define BUILD_COUNT "003" diff --git a/sources/Application/Model/Project.h b/sources/Application/Model/Project.h index df99daf22..9207da5c7 100644 --- a/sources/Application/Model/Project.h +++ b/sources/Application/Model/Project.h @@ -10,7 +10,7 @@ #include "Foundation/Variables/VariableContainer.h" #include "Song.h" -#define PROJECT_NUMBER "2.1-JumpSection" +#define PROJECT_NUMBER "2.1-BETA1" #define PROJECT_RELEASE "r" // BUILD_COUNT define comes from BuildNumber.h From e292d5156965714f3f6ddcb6d61e2d2467561ef2 Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Tue, 3 Jun 2025 17:22:43 +0200 Subject: [PATCH 08/10] PhraseView::DrawView: update cmdEdit(Field) when cursor is in a param col This fixes the cursor being rendered twice after jumpToNextSection in one of the param columns in the PhraseView. --- sources/Application/Views/PhraseView.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sources/Application/Views/PhraseView.cpp b/sources/Application/Views/PhraseView.cpp index 26adee399..407bc5648 100644 --- a/sources/Application/Views/PhraseView.cpp +++ b/sources/Application/Views/PhraseView.cpp @@ -1411,7 +1411,22 @@ void PhraseView::DrawView() { OnPlayerUpdate(PET_UPDATE); }; + // if in one of the param columns, update cmdEdit(Field) as well if ((viewMode_ != VM_SELECTION) && ((col_ == 3) || (col_ == 5))) { + // get current (new) cursor position + GUIPoint p; + p._y = row_ + anchor._y; + p._x = anchor._x + ((col_ == 3) ? 12 : 21); + + // update cmdEditField with current position + cmdEditField_->SetPosition(p); + + // Update the command edit field's value with the current parameter + ushort *paramPtr = + (col_ == 3) ? &phrase_->param1_[16 * viewData_->currentPhrase_ + row_] + : &phrase_->param2_[16 * viewData_->currentPhrase_ + row_]; + cmdEdit_.SetInt(*paramPtr); + cmdEditField_->SetFocus(); cmdEditField_->Draw(w_); }; From 0fa6cf396fd7e1e8caf137a1452adbc5b78fab63 Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Tue, 3 Jun 2025 17:33:14 +0200 Subject: [PATCH 09/10] detect gaps for param1/2 col based on cmd1/2 column in PhraseView::jumpToNextSection --- sources/Application/Views/PhraseView.cpp | 60 ++++++------------------ 1 file changed, 15 insertions(+), 45 deletions(-) diff --git a/sources/Application/Views/PhraseView.cpp b/sources/Application/Views/PhraseView.cpp index 407bc5648..0b756c35f 100644 --- a/sources/Application/Views/PhraseView.cpp +++ b/sources/Application/Views/PhraseView.cpp @@ -13,6 +13,13 @@ #include #include +#define NOTE_COLUMN 0 +#define INSTR_COLUMN 1 +#define CMD1_COLUMN 2 +#define PARAM1_COLUMN 3 +#define CMD2_COLUMN 4 +#define PARAM2_COLUMN 5 + short PhraseView::offsets_[2][4] = {-1, 1, 12, -12, -1, 1, 16, -16}; PhraseView::PhraseView(GUIWindow &w, ViewData *viewData) @@ -333,10 +340,8 @@ void PhraseView::jumpToNextSection(int direction) { int current = row_; bool foundGap = false; - // Find a gap and then find non-gap item in the chosen direction switch (col_) { - // Note column - case 0: { + case NOTE_COLUMN: { for (int i = 0; i < PHRASE_ROW_COUNT; i++) { uchar note = phrase_->note_[phraseStart + current]; if (foundGap && note != NO_NOTE_ASSIGNED) { @@ -353,8 +358,7 @@ void PhraseView::jumpToNextSection(int direction) { break; } - // Instrument column - case 1: { + case INSTR_COLUMN: { for (int i = 0; i < PHRASE_ROW_COUNT; i++) { uchar instrument = phrase_->instr_[phraseStart + current]; if (foundGap && instrument != NO_INSTRUMENT_ASSIGNED) { @@ -371,8 +375,9 @@ void PhraseView::jumpToNextSection(int direction) { break; } - // Command1 column - case 2: { + // find gap based on cmd1 for both columns + case CMD1_COLUMN: + case PARAM1_COLUMN: { for (int i = 0; i < PHRASE_ROW_COUNT; i++) { FourCC command = phrase_->cmd1_[phraseStart + current]; if (foundGap && command != FourCC::InstrumentCommandNone) { @@ -389,26 +394,9 @@ void PhraseView::jumpToNextSection(int direction) { break; } - // Param1 column - case 3: { - for (int i = 0; i < PHRASE_ROW_COUNT; i++) { - ushort param = phrase_->param1_[phraseStart + current]; - if (foundGap && param != 0) { - break; - } else if (param == 0) { - foundGap = true; - } - current += direction; - if (current < 0) - current += PHRASE_ROW_COUNT; - if (current >= PHRASE_ROW_COUNT) - current -= PHRASE_ROW_COUNT; - } - break; - } - - // Command2 column - case 4: { + // find gap based on cmd2 for both columns + case CMD2_COLUMN: + case PARAM2_COLUMN: { for (int i = 0; i < PHRASE_ROW_COUNT; i++) { FourCC command = phrase_->cmd2_[phraseStart + current]; if (foundGap && command != FourCC::InstrumentCommandNone) { @@ -425,24 +413,6 @@ void PhraseView::jumpToNextSection(int direction) { break; } - // Param2 column - case 5: { - for (int i = 0; i < PHRASE_ROW_COUNT; i++) { - ushort param = phrase_->param2_[phraseStart + current]; - if (foundGap && param != 0) { - break; - } else if (param == 0) { - foundGap = true; - } - current += direction; - if (current < 0) - current += PHRASE_ROW_COUNT; - if (current >= PHRASE_ROW_COUNT) - current -= PHRASE_ROW_COUNT; - } - break; - } - default: { Trace::Error("PHRASEVIEW: jumpToNextSection received unexpected value for " "col %d not implemented", From 2ff38142fc347beaaec6eaf3e8e57f5695bb5ed4 Mon Sep 17 00:00:00 2001 From: Christoph Porod-Wanasek Date: Thu, 19 Jun 2025 00:09:31 +0200 Subject: [PATCH 10/10] songview: always jump to next sections top if in live mode --- sources/Application/Views/SongView.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sources/Application/Views/SongView.cpp b/sources/Application/Views/SongView.cpp index f0004d6ba..4a587a47e 100644 --- a/sources/Application/Views/SongView.cpp +++ b/sources/Application/Views/SongView.cpp @@ -447,9 +447,10 @@ void SongView::jumpToNextSection(int direction) { current -= SONG_ROW_COUNT; } } - // If we go backwards, we stil have to go to the beginning of the block - if (direction < 0) { + // In live mode, when we go backwards, we still have to go to the beginning of + // the block + if (Player::GetInstance()->GetSequencerMode() == SM_LIVE && direction < 0) { while (current > 0) { unsigned char *start = viewData_->song_->data_ + viewData_->songX_ + SONG_CHANNEL_COUNT * current;