/*! \mainpage The RtMidi Tutorial
OS: | MIDI API: | Preprocessor Definition: | Library or Framework: | Example Compiler Statement: |
Linux | ALSA Sequencer | __LINUX_ALSA__ | asound, pthread | g++ -Wall -D__LINUX_ALSA__ -o midiprobe midiprobe.cpp RtMidi.cpp -lasound -lpthread |
Linux or Mac | Jack MIDI | __UNIX_JACK__ | jack | g++ -Wall -D__UNIX_JACK__ -o midiprobe midiprobe.cpp RtMidi.cpp -ljack |
Macintosh OS X | CoreMidi | __MACOSX_CORE__ | CoreMidi, CoreAudio, CoreFoundation | g++ -Wall -D__MACOSX_CORE__ -o midiprobe midiprobe.cpp RtMidi.cpp -framework CoreMIDI -framework CoreAudio -framework CoreFoundation |
Windows | Multimedia Library | __WINDOWS_MM__ | winmm.lib, multithreaded | compiler specific |
Windows | Kernel Streaming | __WINDOWS_KS__ | ks.h, ksmedia.h, setupapi.lib, ksuser.lib, multithreaded | compiler specific |
The example compiler statements above could be used to compile the midiprobe.cpp example file, assuming that midiprobe.cpp, RtMidi.h, RtError.h, and RtMidi.cpp all exist in the same directory. \section debug Debugging If you are having problems getting RtMidi to run on your system, try passing the preprocessor definition __RTMIDI_DEBUG__ to the compiler (or define it in RtMidi.h). A variety of warning messages will be displayed that may help in determining the problem. Also try using the programs included in the test directory. The program midiprobe displays the queried capabilities of all MIDI ports found. \section multi Using Simultaneous Multiple APIs Support for each MIDI API is encapsulated in specific MidiInApi or MidiOutApi subclasses, making it possible to compile and instantiate multiple API-specific subclasses on a given operating system. For example, one can compile both the CoreMIDI and Jack support on the OS-X operating system by providing the appropriate preprocessor definitions for each. In a run-time situation, one might first attempt to determine whether any Jack ports are available. This can be done by specifying the api argument RtMidi::UNIX_JACK when attempting to create an instance of RtMidiIn or RtMidiOut. If no available ports are found, then an instance of RtMidi with the api argument RtMidi::MACOSX_CORE can be created. Alternately, if no api argument is specified, RtMidi will first look for CoreMIDI ports and if none are found, then Jack ports (in linux, the search order is ALSA and then Jack; in windows, the search order is WinMM and then WinKS). In theory, it should also be possible to have separate instances of RtMidi open at the same time with different underlying API support, though this has not been tested. The static function RtMidi::getCompiledApi() is provided to determine the available compiled API support. The function RtMidi::getCurrentApi() indicates the API selected for a given RtMidi instance. \section apinotes API Notes RtMidi is designed to provide a common API across the various supported operating systems and audio libraries. Despite that, some issues should be mentioned with regard to each. \subsection linux Linux: RtMidi for Linux was developed using the Fedora distribution. Two different MIDI APIs are supported on Linux platforms: ALSA and Jack. A decision was made to not include support for the OSS API because the OSS API provides such limited functionality and because ALSA support is now incorporated in the Linux kernel. The ALSA sequencer and Jack APIs allows for virtual software input and output ports. \subsection macosx Macintosh OS X (CoreAudio): The Apple CoreMidi API allows for the establishment of virtual input and output ports to which other software applications can connect. The RtMidi Jack support can be compiled on Macintosh OS-X systems, as well as in Linux. \subsection windowsds Windows (Multimedia Library): The \c configure script provides support for the MinGW compiler. The Windows Multimedia library MIDI calls used in RtMidi do not make use of streaming functionality. Incoming system exclusive messages read by RtMidiIn are limited to a length as defined by the preprocessor definition RT_SYSEX_BUFFER_SIZE (set in RtMidi.cpp). The default value is 1024. There is no such limit for outgoing sysex messages via RtMidiOut. RtMidi was originally developed with Visual C++ version 6.0. The \c configure script provides support for the MinGW compiler. \section acknowledge Acknowledgements Many thanks to the following people for providing bug fixes and improvements: