MidiConnect


Connects or disconnects two applications. The MidiConnect function allows the switching on or off of a connection between a source application and a destination application. There is no restrictions in the establishing of these connections, an application can be the source or destination of as many other applications as you wish. Loops are permitted.

pascal void     MidiConnect (short src, short dest, boolean state);

src
a 16-bit integer, is the reference number of the source application.
dest
a 16-bit integer, is the reference number of the destination application.
state
a boolean, indicates if a connection must be switched on (True) or off (False).


Open a MidiShare application and connect it to the physical Midi inputs and outputs.


#include <MidiShare.h>
#define PHYSMIDI_IO 0        /* The MidiShare physical Midi I/O ports*/

Main()
{
    short    myRefNum;

    myRefNum = MidiOpen("MidiSample");

    MidiConnect (PHYSMIDI_IO, myRefNum, TRUE);/* to receive events */
    MidiConnect (myRefNum, 0, TRUE);/* to transmit events */

    /* ....... */

    MidiClose(myRefNum);
}

the physical Midi inputs and outputs are represented by the pseudo application called "MidiShare" with a reference number of 0 (zero). This pseudo application is automatically created when MidiShare wakes up at the very first MidiOpen.