Channel number in NoteOn event always zero?

SDK for VST 3 audio plug-in and host development.
Post Reply
haroldhotch
Posts: 7
Joined: Thu Jan 31, 2019 11:32 pm

Channel number in NoteOn event always zero?

Post by haroldhotch » Sun Mar 03, 2019 1:49 am

My multi-timbral VST3 plugin uses 16 MIDI channels in the Event bus (see code below). I set my MIDI keyboard to output all notes & CC on channel 2. I verify that the keyboard is outputting on channel 2 by playing the keyboard into VST2 plugins and confirm channel 2. But when running the VST3 plugin, all incoming Note events arrive in Processor::process() with channel zero (channel number gotten from event.noteOn.channel ).

In my DEF_CLASS2 macro for the Processor, I'm using value zero for ComponentFlags (I use neither kDistributable nor kSimpleModeSupported).

What is the plugin doing that would cause Cubase host to change the noteOn channel # from 2 to 0 before it sends the event to the plugin?

Here is software in ::process() that is receiving the NoteOn event:

Code: Select all

IEventList* eventList = data.inputEvents;
int32 numEvent = eventList->getEventCount ();
	 ....
		Event event;
		if (eventList->getEvent (i, event) == kResultOk)
		{ 
		switch (event.type)
			{
 				case Event::kNoteOffEvent:
  				case Event::kNoteOnEvent: {
                                    if ( Event::kNoteOnEvent == event.type ){  
                                          unsigned char channelNumber = BOUND ( 0, event.noteOn.channel, 15);  
Here is software that defines 16 MIDI channels for the event bus:

Code: Select all

tresult PLUGIN_API VST3_Processor::getBusInfo (MediaType mediaType, BusDirection dir, int32 index, BusInfo& info)    {
    if (( dir == kInput  ) && ( index >= kNumInputBusses)) return kResultFalse;
    if (( dir == kOutput ) && ( index >= kNumOutputBusses )) return kResultFalse;
    info.mediaType = mediaType;	///< Media type - has to be a value of \ref MediaTypes
    info.direction = dir; ///< input or output \ref BusDirections
    if ( kAudio == mediaType  ) {
        info.channelCount = 2;  // numer of speakers, e.g. 2 == stereo
    } else {  // Event aka MIDI events
          info.channelCount = kNumMidiChannels;  // 16
    }....
    

haroldhotch
Posts: 7
Joined: Thu Jan 31, 2019 11:32 pm

Re: Channel number in NoteOn event always zero?

Post by haroldhotch » Wed Mar 06, 2019 10:11 pm

Bumping this.

Is the NoteOn event's channel always equal to zero? Or are there situations where the host will to provide the (sometimes non-zero) MIDI channel in the NoteOn event?

If channel can be non-zero, what must the plugin do to instruct the host to relay the non-zero channel number?

As shown above, my plugin's method ::getBusInfo() is defining 16 MIDI channels per input event bus.

Thanks in advance for any tips!

Arne Scheffler
Posts: 276
Joined: Mon Jun 20, 2016 7:53 am

Re: Channel number in NoteOn event always zero?

Post by Arne Scheffler » Mon Mar 18, 2019 3:21 pm

I think you have setup Cubase wrong. This works with other plug-ins.

Cheers,
Arne

Post Reply