The Hardware Class

Each MIDI port or other hardware that can receive or transmit MIDI data is a Type A device. A Type A device is supported by one Type A driver, but a Type A driver can support any number of Type A devices. The Type A devices belong to the Type A driver. This means that if a card has two MIDI ports, and one driver is used to support both ports, that driver will belong to two hardware nodes.

The hardware class is used to represent Type A devices. In order for a Type A device to be recognized by RTMIDI, its Type A driver must register the device with RTMIDI. For each device registered, an instance of the hardware class is created.

A hardware node communicates with the Type A driver via inter-device-driver communication, or IDC calls. These are simple far (16:16) calls made from one driver to another, and the calling convention is defined by the drivers. (Inter-device-driver communication is described in detail in the Physical Device Driver Reference.)

The MIDI bytes from any messages that are sent to the hardware node are immediately transmitted to the Type A driver, and any data sent from the driver to RTMIDI is packaged into compound messages and forwarded.

When a hardware node is enabled, it tells the corresponding driver to open. This usually means attaching the IRQ and initializing the hardware.

RTMIDI supports the concept of instance names. During Type A registration, the Type A driver tells RTMIDI what the name of the Type A device is. This is typically more descriptive than the eight-byte name stored in the Type A driver's device header. For instance, the MPU-401 driver's device name is "MPU401$", but its instance name is "MPU-401 #1 (I/O=0330, IRQ=05)". If the name already exists, an error is returned, and the driver can either pick another name and try again, or fail to load.


[Back: Pre-defined Classes]
[Next: The Application Class]