Skip to content

Commit

Permalink
toggle step gate with double press
Browse files Browse the repository at this point in the history
fixes #232
  • Loading branch information
westlicht committed Oct 23, 2020
1 parent 4c6f291 commit 5a3a2ae
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,18 @@ void LaunchpadController::sequenceButton(const Button &button, ButtonAction acti
if (button.is<Fill>()) {
_project.playState().fillAll(false);
}
} else if (action == ButtonAction::DoublePress) {
if (!buttonState<Shift>() &&
!buttonState<Navigate>() &&
!buttonState<Layer>() &&
!buttonState<FirstStep>() &&
!buttonState<LastStep>() &&
!buttonState<RunMode>() &&
!buttonState<Fill>() &&
button.isGrid()) {
// toggle gate
sequenceToggleStep(button.row, button.col);
}
}
}

Expand Down Expand Up @@ -375,6 +387,32 @@ void LaunchpadController::sequenceSetRunMode(int mode) {
}
}

void LaunchpadController::sequenceToggleStep(int row, int col) {
switch (_project.selectedTrack().trackMode()) {
case Track::TrackMode::Note:
sequenceToggleNoteStep(row, col);
break;
default:
break;
}
}

void LaunchpadController::sequenceToggleNoteStep(int row, int col) {
auto &sequence = _project.selectedNoteSequence();
auto layer = _project.selectedNoteSequenceLayer();

int linearIndex = col + _sequence.navigation.col * 8;

switch (layer) {
case NoteSequence::Layer::Gate:
case NoteSequence::Layer::Slide:
break;
default:
sequence.step(linearIndex).toggleGate();
break;
}
}

void LaunchpadController::sequenceEditStep(int row, int col) {
switch (_project.selectedTrack().trackMode()) {
case Track::TrackMode::Note:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ class LaunchpadController : public Controller {
void sequenceSetFirstStep(int step);
void sequenceSetLastStep(int step);
void sequenceSetRunMode(int mode);
void sequenceToggleStep(int row, int col);
void sequenceToggleNoteStep(int row, int col);
void sequenceEditStep(int row, int col);
void sequenceEditNoteStep(int row, int col);
void sequenceEditCurveStep(int row, int col);
Expand Down

0 comments on commit 5a3a2ae

Please sign in to comment.