Very minor bug. I assume it's a bug because it comes along with an inconsistency. There are two scenarios:
Steps to reproduce:
- Create a 4/4 segment with 5 measures
- Select a MIDI instrument with long sustain good for a whole note e.g. brass, strings, electric guitar etc
- Place a whole note in measure 1 of the segment
- In measure 4, place a half-note at beat 2 which is a half tone above or below the note in step (3)
- In measure 5, place a whole note and tie it to the half-note in measure 4
- This is now a tied note of one and a half beats
- Now shorten the segment to 4 measures. In MatrixEditor the note appears as a half beat (not tied)
Scenario 1:
- Place three linked copies of the shortened segment back to back on the same track
- Play will be as expected i.e. the half note ends at segment end, the first whole note of the following segment begins, and the remaining whole note beyond segment end is not heard
Scenario 2:
- Same steps as Scenario 1, except delete the middle segment
- Change the first segment to repeating to fill the gap across to the last segment
- The expected behavior should be the same as Scenario 1, except the full tied note is heard at the same time as the first note of the following (repeated) section.
Since the notes are a half-tone apart, when sounded together, with good sustain, it's obvious both are playing unlike in Scenario 1. As an example of usage, in Scenario 2, the user might want identical notes throughout a segment i.e. linked segments, but in one segment have the last note be longer or have other notes appear there. Then they stretch that segment at its location.
Whether the sound of the note should extend beyond the last segment or not is one thing, but the inconsistency between Scenario 1 and 2 remains since replacing the middle segment with the repeating section should not have changed the sound.
This bug led me into the murky world of MappedEventBuffers. A murky place of strange code lines and mystical algorithms.
But anyway I believe I have a fix.
See merge request.