Question on code in Synthesizer::handleController


#1

I’m building a drum machine component and noticed that panning only works if a drum is sounding at the time I move its pan control. The code to call the voice’s handleController method is protected by the followiing guard in Synthesizer::handleController:

 if (midiChannel <= 0 || voice->isPlayingChannel (midiChannel))
            voice->controllerMoved (controllerNumber, controllerValue);

Since midiChannel is obtained with MidiMessage::getChannel which returns zero only if no channel is specified, this implies that voice->handleController is called only if a note is sounding. Am I missing something here? There is a similar guard in Synthesiser::handlePitchWheel. I can work around this problem by handling the pan directly instead of midi, but I’d like to understand what’s going on.

Also, it seems that volume messages (controller 7) are handled somewhere else as they work in SamplerVoice and the body to SampleVoice::handleController is empty.

BTW: I created a subclass of SamplerVoice, PanningSamplerVoice, to handle the panning.[/code]


#2

Please ignore the remark about controller 7; the individual volumes are controlled by varying the Midi note on velocity.