fix thinko when setting MIDI trigger first/last event indices
Unclear why I use this pattern when the change here uses the more normal way of finding the upper/lower of some values. Either way, the code as it was would skip the first event in a MIDI trigger (most of the time, anyway)
This commit is contained in:
@@ -2482,22 +2482,22 @@ MIDITrigger::setup_event_indices ()
|
||||
return;
|
||||
}
|
||||
|
||||
first_event_index = 0;
|
||||
last_event_index = std::numeric_limits<uint32_t>::max();
|
||||
first_event_index = std::numeric_limits<uint32_t>::max();
|
||||
last_event_index = 0;
|
||||
|
||||
for (uint32_t n = 0; n < rt->size(); ++n) {
|
||||
if ((first_event_index == 0) && ((*rt)[n].timestamp >= _play_start)) {
|
||||
if ((first_event_index == std::numeric_limits<uint32_t>::max()) && ((*rt)[n].timestamp >= _play_start)) {
|
||||
/* first one at or after the loop start */
|
||||
first_event_index = n;
|
||||
}
|
||||
|
||||
if ((last_event_index == std::numeric_limits<uint32_t>::max()) && ((*rt)[n].timestamp > _play_end)) {
|
||||
if ((last_event_index == 0) && ((*rt)[n].timestamp > _play_end)) {
|
||||
/* first one at or after the loop end */
|
||||
last_event_index = n; /* exclusive end */
|
||||
}
|
||||
}
|
||||
|
||||
if (last_event_index == std::numeric_limits<uint32_t>::max()) {
|
||||
if (last_event_index == 0) {
|
||||
last_event_index = rt->size();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user