Const-Correctness in MIDIFile/Seqence


would be great if MidiFile would have a non-const variant for ::getTrack. I think the main reason why this works currently is that MidiSeq::getEventPointer although const returns a non-const reference. I think this should be changed and then an actual non-const variant added.

Thanks in advance, keep it up guys!

Why? Wouldn’t

 MidiMessageSequence* MidiFile::getTrack (int index) 

imply that you could change the return value directly, meaning the next call to getTrack, wouldn’t necessarily return the same result as the first? Which I think would be unexpected…

Why would that be unexpected. That is how returning a mutable reference works and very common for containers. And the midi file is really just a list of sequences with a little utility on top.

Nevertheless, this is already possible due to getEventPointer in MidiSeq not being const.