Skip to content

Commit 89c7a53

Browse files
committed
- MIDI Tool Resize / Legato option now applies to all events in general,
not only to same pitch events in particular. (FIXED)
1 parent 08960fd commit 89c7a53

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/qtractorMidiToolsForm.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,8 @@ qtractorMidiEditCommand *qtractorMidiToolsForm::midiEditCommand (
945945
// Go for the main pass...
946946
qtractorTimeScale::Cursor cursor(m_pTimeScale);
947947

948-
// Resize duration: legato/gap filler helper...
949-
QHash<unsigned char, qtractorMidiEvent *> notes;
948+
// Resize/Legato: to track last event...
949+
qtractorMidiEvent *pLastEvent = nullptr;
950950

951951
for ( ; iter != iter_end; ++iter) {
952952
qtractorMidiEvent *pEvent = *iter;
@@ -1168,16 +1168,15 @@ qtractorMidiEditCommand *qtractorMidiToolsForm::midiEditCommand (
11681168
}
11691169
if (m_ui.ResizeLegatoCheckBox->isChecked()
11701170
&& pEvent->type() == qtractorMidiEvent::NOTEON) {
1171-
qtractorMidiEvent *pPrev = notes.value(pEvent->note(), nullptr);
1172-
if (pPrev) {
1171+
if (pLastEvent) {
11731172
const float p
11741173
= 0.01f * float(m_ui.ResizeLegatoSpinBox->value());
11751174
const long d2
1176-
= long(p * float(pPrev->time() - pEvent->time()));
1177-
if (iDuration < d2)
1175+
= long(p * float(pLastEvent->time() - pEvent->time()));
1176+
if (iDuration < d2 && d2 > 0)
11781177
iDuration = d2;
11791178
}
1180-
notes.insert(pEvent->note(), pEvent);
1179+
pLastEvent = pEvent;
11811180
}
11821181
}
11831182
// Rescale tool...

0 commit comments

Comments
 (0)