When running ensureContextAllocated on a TransportControl I end up in the function createNodeForMidiClip which transforms the clips midi channel (16) to a range (16-17)…
The channel numbers are 1-16 inclusive.
The range is just there because if MPE mode is used, it has a range of channels. For single-channel mode, the range length is just 1, so a single channel.
The assert looks correct to me. It’s saying the channel number must be 1-16 inclusive.
Thanks for the clarification of why a juce::Range is used!
I’m trying to use channel 16.
The documentation of juce::Range states that:
Note that when checking whether values fall within the range, the start value is considered to be inclusive, and the end of the range exclusive.
So the range created in createNodeForMidiClip (when generateMPE is false) is [16, 17) (including 16 but excluding 17).
Later on in the assertion, channelNumbers.getEnd() is used which returns 17 and the assertion fails.
To me it seems like (channelNumbers.getEnd() - 1) should be used in the assertion (and probably at some other places in Tracktion Engine too)!?