mirror of
https://github.com/Ardour/ardour.git
synced 2026-01-06 21:55:43 +01:00
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:
parent
c45103c1d7
commit
52996e7a8d
1 changed files with 5 additions and 5 deletions
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue