Skip to content

Commit edaf2d0

Browse files
Merge pull request #2202 from SynthstromAudible/cherry-pick-release/1.1-ab557a5aab31d874c16ace3a0147a9e211d5bf6c
2 parents da12050 + 6ec0ce1 commit edaf2d0

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/deluge/gui/views/instrument_clip_view.cpp

+21-2
Original file line numberDiff line numberDiff line change
@@ -1534,7 +1534,7 @@ ActionResult InstrumentClipView::padAction(int32_t x, int32_t y, int32_t velocit
15341534
if (x == kDisplayWidth + 1) {
15351535

15361536
// "Learning" to this audition pad:
1537-
if (isUIModeActiveExclusively(UI_MODE_MIDI_LEARN)) {
1537+
if (isUIModeActiveExclusively(UI_MODE_MIDI_LEARN)) [[unlikely]] {
15381538
if (getCurrentUI() == this) {
15391539
if (sdRoutineLock) {
15401540
return ActionResult::REMIND_ME_OUTSIDE_CARD_ROUTINE;
@@ -1554,7 +1554,7 @@ ActionResult InstrumentClipView::padAction(int32_t x, int32_t y, int32_t velocit
15541554
}
15551555

15561556
// Changing the scale:
1557-
else if (isUIModeActiveExclusively(UI_MODE_SCALE_MODE_BUTTON_PRESSED)) {
1557+
else if (isUIModeActiveExclusively(UI_MODE_SCALE_MODE_BUTTON_PRESSED)) [[unlikely]] {
15581558
if (sdRoutineLock) {
15591559
return ActionResult::REMIND_ME_OUTSIDE_CARD_ROUTINE;
15601560
}
@@ -1571,6 +1571,25 @@ ActionResult InstrumentClipView::padAction(int32_t x, int32_t y, int32_t velocit
15711571
}
15721572
}
15731573
}
1574+
else if (currentUIMode == UI_MODE_HOLDING_SAVE_BUTTON && velocity) [[unlikely]] {
1575+
Instrument* instrument = getCurrentInstrument();
1576+
1577+
bool isKit = (instrument->type == OutputType::KIT);
1578+
if (isKit) {
1579+
// this is fine - since it's a kit we don't need the song, it's only used to check scale for
1580+
// instrument clips
1581+
NoteRow* noteRow =
1582+
getCurrentInstrumentClip()->getNoteRowOnScreen(y, nullptr, nullptr); // On *current* clip!
1583+
1584+
if (noteRow && noteRow->drum && noteRow->drum->type == DrumType::SOUND) {
1585+
auto* drum = static_cast<SoundDrum*>(noteRow->drum);
1586+
currentUIMode = UI_MODE_NONE;
1587+
indicator_leds::setLedState(IndicatorLED::SAVE, false);
1588+
saveKitRowUI.setup(static_cast<SoundDrum*>(drum), &noteRow->paramManager);
1589+
openUI(&saveKitRowUI);
1590+
}
1591+
}
1592+
}
15741593

15751594
// Actual basic audition pad press:
15761595
else if (!velocity || isUIModeWithinRange(auditionPadActionUIModes)) {

src/deluge/model/clip/instrument_clip.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ ModelStackWithNoteRow* InstrumentClip::getNoteRowOnScreen(int32_t yDisplay, Mode
964964
return modelStack->addNoteRow(noteRowId, noteRow);
965965
}
966966

967+
/// can be called with null song if the clip is a kit
967968
NoteRow* InstrumentClip::getNoteRowOnScreen(int32_t yDisplay, Song* song, int32_t* getIndex) {
968969
// Kit
969970
if (output->type == OutputType::KIT) {

0 commit comments

Comments
 (0)