Copied Time Instant Layer does not include instant at end of track
Brought to you by:
cannam
When I copy a time instant layer to paste into new layer, the ending time instant is not included when it is at the end of the audio file. This bug is apparent when dividing time instances into new ones. To replicate this bug, first create a time instant layer, select all and then "insert time instances at selection boundries" so that two instances are create, one at the beginning and one at the end of the audio file. Now select all, and divide the instances into four again. Copy, the contents of the layer into a new one. Divide once again into four and noticed the last two adjacent time instances, which included the ending one are not divided.
This bug occurs in the current stable release 3.0.3.
Confirmed
When you "insert instants at selection boundaries", the second time instant is actually inserted just beyond the end of the selection, i.e. at the first frame number that is not contained within the selection.
This is by design, because it means that the time difference between the two inserted instants is the same as the length of the selection. For example, if you make a selection that only spans a single sample, and then use this function, you get two separate instants inserted one sample apart; it doesn't try to create two instants at the same sample number. If you select 44100 samples and then use it, you get two instants whose sample numbers are separated by 44100 and are therefore exactly one second apart if the underlying audio rate is 44100Hz.
But in this case it's the start of a problem:
In this case, the second instant is not included even if you "select all" again after creating the new instants. That's because of another unfortunate bit of behaviour:
The latter is a fairly significant problem in its own right. For example if you first open a short audio file, then "import more audio" to open a longer one, and finally scroll to a point in the longer file beyond the end of the shorter one and create some instants there, then those instants will not be selected by any subsequent "select all".
So the first thing, I think, is to ensure that "select all" selects the whole span of everything in the session, not just the first (main) audio file.
Done that first thing, in commit 0e963dac67e2 - "select all" now creates a selection spanning everything that exists anywhere.
That change is rolled out in v3.1.