mdInit(3dm) mdInit(3dm) NAME mdInit, mdRegister, mdUnRegister - initialize MIDI system and register new interfaces SYNOPSIS #include <dmedia/midi.h> int mdInit(void); char *mdRegister(const char *name); int mdUnRegister(const char *name); DESCRIPTION mdInit initializes the MIDI library and returns the current number of configured MIDI interfaces. mdInit must be called before the application calls any other MIDI library routines. mdInit returns 0 if no interfaces are configured. An application may call mdInit multiple times to update the MIDI library's internal list of available ports. Any interfaces configured after the initial call to mdInit will be inaccessible by the application until mdInit is called again; long-running applications which maintain a list of active devices should call mdInit periodically to insure that their device list is up-to-date. Calling mdInit multiple times has no effect on previously opened ports. mdRegister creates a new internal MIDI interface named name. If an interface with the requested name is already configured, mdRegister will generate a new unique name for the port and return the unique name (this is done by appending a digit onto the end of the name). mdRegister returns the name of the device or NULL in event of an error. mdUnRegister removes the internal MIDI interface indicated by name. mdUnRegister returns 0 if the interface is successfully removed. If an error occurs, -1 will be returned instead. Internal interfaces must be explicitly unregistered when an application is finished with them; they are a limited resource and are not released when the application which originally created them exits. RETURN VALUES mdInit returns the number of valid devices on the system or -1 on failure. mdRegister returns the name used for the new interface; if the registration fails, NULL is returned. The storage for the returned name is allocated by malloc. The caller should call free() when it is done with the name. mdUnRegister returns 0 on success; if it fails, it returns -1. SEE ALSO mdIntro(3dm) Page 2