View Single Post
Old 03-14-2018, 03:13 AM   #8
azslow3
Human being with feelings
 
Join Date: Nov 2017
Location: Heidelberg, Germany
Posts: 797
Default

Quote:
Originally Posted by mschnell View Post
Yep, StuffMIDIMessage, obviously.
...

But MidiToReaControlPath is not a Reaper Extension DLL but a VST DLL, and hence is dynamically linked according to the VST specifications and does not know how to call "StuffMIDIMessage()".

AFAIU, the tricky part is to have a VST it access the Reaper API altogether.
What about reading the documentation? Obviously
https://www.reaper.fm/sdk/vst/vst_ext.php

Disclaimer: I have not written any release quality VSTs, so the following is IMHO. But working IMHO.
I usually check what I suggest. So I have written a test VST which send all CC to control and pass throw the rest. In my short check it was working as expected.

Mentioned documentation has no examples. More tricky is to find the RIGHT way to process MIDI in VST. The specification is a bit fussy at that place. It seems like that working way is save events in "processEvents" and "sendVstEventsToHost" in "processReplacing".

So parts of the code:
Code:
static void (*StuffMIDIMessage)(int mode, int msg1, int msg2, int msg3) = 0;

MyEffect::MyEffect(audioMasterCallback audioMaster) : AudioEffectX(audioMaster, kNumPrograms, kNumParams){
static char StuffMIDIMessage_Name[] = "StuffMIDIMessage";
...
if(!StuffMIDIMessage)
    StuffMIDIMessage = (void (*)(int, int, int, int))audioMaster(NULL,0xdeadbeef,0xdeadf00d,0,StuffMIDIMessage_Name,0.0);
// I do not use the name directly, GCC complains the parameter is not const
}

void MyEffect::processReplacing(float** inputs, float** outputs, VstInt32 sampleFrames){
 ...
 StuffMIDIMessage(1, midiData[0], midiData[1], midiData[2]);
}
azslow3 is offline   Reply With Quote