How to send a Midi message (sysex, CC and NRPN) | Page 2 | Synth Book Questions | Forum


Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

No permission to create posts
sp_Feed Topic RSS sp_TopicIcon
How to send a Midi message (sysex, CC and NRPN)
December 11, 2015 - 6:35 am
Member Since: April 3, 2014
Forum Posts: 75
sp_UserOfflineSmall Offline


I only tried 32 bit as I tested with RackAFX, not a plain VST plugin.

The "multithreaded" library refers to the c++ CRT library which used to exist as single-threaded and mutli-threaded version until Visual Studio 2008 AFAIR. Newer versions only have the multi-threaded CRT, so this is nothing you need to care about with newer compilers. You won't need to use multiple threads for multiple midi connections, you just can call "getMessage" sequentially for multiple ports.

The MMSYSERR_ALLOCATED code looks like the driver is already in use by your process. What may be the problem is that the operating system only sees one process (your DAW) that already has openened the midi port, so you can't open it again from your plugin (which from the operating system's point of view is still the same process). What you could do in this case is to spawn a process from your plugin and do midi from there and use some interprocess-communication between the plugin and that "midi process" to connect them. However, if you can route the MIDI yoke ports accordingly it may be easier to use dedicated ports.


December 12, 2015 - 6:20 am
Member Since: September 14, 2015
Forum Posts: 24
sp_UserOfflineSmall Offline

Hello Tom

Thank you for your answer. You helped me go into the right direction.

I tried RackAFX. I could open the port and send midi and I could even debug with RackAFX.
Then I returned to my old project and suddenly it worked as well. And then suddenly it didn't after
a few compiles. There is definitely something strange going on when I use my host as the debug command . I hope I can pinpoint it in the future.

One thing was very strange though. Running the RackAfx project gave me all the ports including the Midi Yoke ports.
Running the SDK test project didn't give me the Midi Yoke ports. Don't even know where to begin with that. ­čśÇ

The most important thing at this moment is that I managed to send a midi message. Now what I need to do is populate 2 listboxes with the input and output ports.

August 23, 2017 - 5:10 am
Member Since: February 7, 2017
Forum Posts: 7
sp_UserOfflineSmall Offline

W Pirkle said

To transmit a Note On event, you would add this to the end of the process( ) method:

// --- get the event list for output
IEventList* outputEvents = data.outputEvents;

(Thanks for all of your help, Will!)

I would like to know more about ownership of the output IEventList (I see that it's pure virtual for one). The Steinberg docs and example code are either hopelessly silent on the matter, or I have missed some valuable source of information.

When I step into my plugin, data.outputEvents is a null pointer in the process() method. Should I create a member of type CVSTMidiEventList (which I see overrides the virtual methods in IEventList) and assign its pointer to data.outputEvents? What about lifecycle management of outputEvents? Etc.... 

Should I ask this on the Steinberg forums?

August 23, 2017 - 10:03 am
Member Since: January 28, 2017
Forum Posts: 701
sp_UserOfflineSmall Offline

You need to setup an output port for MIDI. In the VSTProcessor::Initialize( ) function, add the port

addEventOutput(STR16("Event Output"), 16);

Then your data output pointer will be non-null. You are highly limited to the kind of MIDI data you can send. See the fourth post at the top of this thread

- Will

No permission to create posts
Forum Timezone: America/New_York

Most Users Ever Online: 152

Currently Online:
5 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Chaes: 56

Skyler: 48

StevieD: 46

Derek: 46

Frodson: 45

Peter: 43

TheSmile: 43

Nickolai: 43

clau_ste: 39

jeanlecode: 37

Member Stats:

Guest Posters: 2

Members: 794

Moderators: 1

Admins: 6

Forum Stats:

Groups: 13

Forums: 42

Topics: 857

Posts: 3395

Moderators: W Pirkle: 701