WDL plugin won't listen to Midi CC Data
Hello, everyone. I'm hoping to find someone who has been able to get WDL-OL to react to MIDI Controller changes such as ModWheel and PitchWheel. I have done much searching on this forum and on the KVR forum, and I find people claiming to have accomplished this, but none whom have shared clear examples of working code. Please note that I've created a VST3 plugin using WDL downloaded as of early 2017, in a Windows 8.1 environment with MS Visual Studio 2013 as my IDE.
To troubleshoot my problem, I created an extremely simplistic plugin that does nothing but pass mData1 and mData2 (regardless of StatusMsg() value) from the IMidiMsg into variables that are then written out to a text file for logging/testing purposes. I can see clearly that when a Note On or Note Off are sent from Cubase to the plugin, I get a line item in my text file that shows the status (8 for NoteOff and 9 for NoteOn) and then the value of the note (data1) and the value of the velocity (data2). However, when any PitchWheel or ControlChange messages are sent from Cubase to the plugin, there are no line entries in the text file whatsoever.
Here is my code for ProcessMidiMsg:
[code]
void TPlugMidiCC::ProcessMidiMsg(IMidiMsg* pMsg)
{
IMidiMsg::EStatusMsg status = pMsg->StatusMsg();
int data1 = (int)pMsg->mData1;
int data2 = (int)pMsg->mData2;
output
<< status
<< " "
<< data1
<< " "
<< data2
<< " "
<< "\n"
;
mMidiQueue.Add(pMsg);
return;
}
[\code]
At first I was trying to get the MidiQueue working from within ProcessDoubleReplacing, but I've now bypassed that altogether to simplify the code in the hopes of getting to the bottom of this problem.
Nevertheless, here is the code from ProcessDoubleReplacing for those who want to see it:
[code]
void TPlugMidiCC::ProcessDoubleReplacing(double** inputs, double** outputs, int nFrames)
{
// Mutex is already locked for us.
double* in1 = inputs[0];
double* in2 = inputs[1];
double* out1 = outputs[0];
double* out2 = outputs[1];
double peakL = 0.0, peakR = 0.0;
GetTime(&mTimeInfo);
for (int offset = 0; offset < nFrames; ++offset, ++in1, ++in2, ++out1, ++out2)
{
while (!mMidiQueue.Empty())
{
IMidiMsg* pMsg = mMidiQueue.Peek();
if (pMsg->mOffset > offset) break;
mMidiQueue.Remove();
}
*out1 = 0.;
*out2 = 0.;
}
mMidiQueue.Flush(nFrames);
_chdir("C:\\Program Files\\AsiData\\Transcribe");
outputfile.open("TPlugMidiCCOutput.txt");
outputfile << output.str();
outputfile.close();
}
[\code]
Again, I know my code is correct, because my text file has line items showing the raw Midi data and status messages as they come in from Cubase. It's just that WDL is ignoring any data that isn't NoteOn/NoteOff or somehow Cubase isn't sending it to the plugin. I'm inclined to believe the former, since I can send controller data to any of my commercially produced VSTi plugins.
There must be some extra step to stop IMidiMsg from filtering out PitchWheel and ControlChange that may have to be written into the underlying library files. It's nothing to do with the switch(status) cases, because I've removed those completely.
Maybe this only happens with Windows 8.1 / VS2013 / Cubase 6? Or am I missing something that needs to be added to the code?
Thanks in advance for any and all assistance.
|