sending virtual midi to another app no matter if iOS or macOS is a reciprocal procedure.
Why is that?
When you deal with system managed midi buffers in which apps hock up or send to you actually get direct access to its buffer, as you just place a callback that gives you the data or a place to send to. Now virtual midi means it is not just a software receiver it is also a buffer managed by the system but allocated by the app that claimed a callback onto it when creating its virtual-In midi buff. Means a mac-virtual-midi-buffer owned by another app will receive data when its callback is triggered to analyse what came in and wise versa trigger your callback with a receive command when your app should receive data. Which leads to a reciprocal behaviour which is not extensively documented but very logic. Otherwise the system would have to shuffle midi buffers on top just to flip flop the reciprocal calls needed.
So what do you do to address such?
yes.
Sending to another App Virtual-Midi-Port is realised when you make a "MIDIReceived" call with the data and wise versa.
Receiving from another App Virtual-Midi-Port is realised when the other app calls "MIDIReceived" with the data for your apps buffer in effect triggering your input callback.
so in code you want to distinguish between virtual devices and physical devices to use the right mechanism for each of them.
Code: Select all
// as seen in sound_apple_midi.hpp > device_midi_client_send_event()
MIDISend( port->port, port->endpoint, &list ); //to normal real physical existing device
MIDIReceived(port->endpoint, &list); // to virtual port of another app
PS:
bool isVirtualPort in sunvox_midi_port for mac and set it at virtual (main) port creation so it can be used to distinguish which function to use, depending on port: either physical or virtual.