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)…
const auto channels = generateMPE ? juce::Range<int> (2, 15)
: juce::Range<int>::withStartAndLength (clip.getMidiChannel().getChannelNumber(), 1);
…before making a MidiNode…
…which finally fails this assertion…
jassert (channelNumbers.getStart() > 0 && channelNumbers.getEnd() <= 16);
- Why does MidiNode have a range of midi channels instead of a singel midi channel?
- It seems like this implies that a MidiClip cannot use channel 16!?
Something I should clarify?
@DRow is currently on holiday, he should be back next week.
What channel are you trying to use?
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)!?
Thanks, I found a couple of more places where similar assertions should be fixed as far as I understand, so I made a PR: MidiNode: Fixed a couple of assertions regarding the range channelNumbers end
Cheers. Will get that merged soon.
Should be fixed on