I noticed what looks like odd behavior while using the AddTrack() method... I might be misunderstanding how to use it but here is some brief debug code to illustrate the situation:
{{
MidiEventCollection collection = new MidiEventCollection(1, PulsesPerQuarterNote);
collection.AddTrack();
collection.AddEvent(new NoteEvent(1, 1, MidiCommandCode.NoteOn, 60, 100), 0);
collection.AddEvent(new NoteEvent(300, 1, MidiCommandCode.NoteOff, 60, 0), 0);
collection.AddTrack();
collection.AddEvent(new NoteEvent(1, 2, MidiCommandCode.NoteOn, 60, 100), 1);
collection.AddEvent(new NoteEvent(300, 2, MidiCommandCode.NoteOff, 60, 0), 1);
collection.AddTrack();
collection.AddEvent(new NoteEvent(1, 3, MidiCommandCode.NoteOn, 60, 100), 3);
collection.AddEvent(new NoteEvent(300, 3, MidiCommandCode.NoteOff, 60, 0), 3);
collection.PrepareForExport();
}}
After running AddTrack() for the first time, the Tracks property of collection increments to 1.
then after running AddEvent(..., 0), the Tracks property of collection increments to 2, but the notes are added to Track 1.
I would have expected the noteEvents to be added to Track 0 as specified as a parameter in the AddEvent(...., 0) method.
is there no Track 0?
Also, I would not have expected the Tracks property to increment when using AddEvent.
Proceeding, AddTrack is run a second time, the Tracks property increments to 3. (this behavior seems expected)
Running AddEvent(...,1) twice specifying destination Track as 1 results in 2 more note events added to Track 1 (this behavior seems expected).
Then AddTrack is run a third time, the Tracks property increments to 4. (this seems expected)
Running AddEvent(...,3) twice specifying destination Track as 3 results in 2 notes added to Track 3 (this seems expected).
After running prepare for export, there are only 2 tracks instead of 3 (as intended).
And there are 2 notes that I tried to put on track 0 that wound up on track 1.
Is this a bug? or am I missing some details of the usage?
Thanks for looking into it.
{{
MidiEventCollection collection = new MidiEventCollection(1, PulsesPerQuarterNote);
collection.AddTrack();
collection.AddEvent(new NoteEvent(1, 1, MidiCommandCode.NoteOn, 60, 100), 0);
collection.AddEvent(new NoteEvent(300, 1, MidiCommandCode.NoteOff, 60, 0), 0);
collection.AddTrack();
collection.AddEvent(new NoteEvent(1, 2, MidiCommandCode.NoteOn, 60, 100), 1);
collection.AddEvent(new NoteEvent(300, 2, MidiCommandCode.NoteOff, 60, 0), 1);
collection.AddTrack();
collection.AddEvent(new NoteEvent(1, 3, MidiCommandCode.NoteOn, 60, 100), 3);
collection.AddEvent(new NoteEvent(300, 3, MidiCommandCode.NoteOff, 60, 0), 3);
collection.PrepareForExport();
}}
After running AddTrack() for the first time, the Tracks property of collection increments to 1.
then after running AddEvent(..., 0), the Tracks property of collection increments to 2, but the notes are added to Track 1.
I would have expected the noteEvents to be added to Track 0 as specified as a parameter in the AddEvent(...., 0) method.
is there no Track 0?
Also, I would not have expected the Tracks property to increment when using AddEvent.
Proceeding, AddTrack is run a second time, the Tracks property increments to 3. (this behavior seems expected)
Running AddEvent(...,1) twice specifying destination Track as 1 results in 2 more note events added to Track 1 (this behavior seems expected).
Then AddTrack is run a third time, the Tracks property increments to 4. (this seems expected)
Running AddEvent(...,3) twice specifying destination Track as 3 results in 2 notes added to Track 3 (this seems expected).
After running prepare for export, there are only 2 tracks instead of 3 (as intended).
And there are 2 notes that I tried to put on track 0 that wound up on track 1.
Is this a bug? or am I missing some details of the usage?
Thanks for looking into it.