Using midiOutShortMsg to Send Individual MIDI Messages
The following example uses the midiOutShortMsg function to send a specified MIDI event to a given MIDI output device:
Copy Code
UINT sendMIDIEvent(HMIDIOUT hmo, BYTE bStatus, BYTE bData1,
BYTE bData2)
{
union {
DWORD dwData;
BYTE bData[4];
} u;
// Construct the MIDI message.
u.bData[0] = bStatus; // MIDI status byte
u.bData[1] = bData1; // first MIDI data byte
u.bData[2] = bData2; // second MIDI data byte
u.bData[3] = 0;
// Send the message.
return midiOutShortMsg(hmo, u.dwData);
}
Note MIDI output drivers are not required to verify data before sending it to an output port. Applications must ensure that only valid data is sent.
阅读(773) | 评论(0) | 转发(0) |