BASS_MIDI_ConvertEvents
Converts raw MIDI data to BASS_MIDI_EVENT structures.
DWORD BASS_MIDI_ConvertEvents(
BYTE *data,
DWORD length
BASS_MIDI_EVENT *events,
DWORD count,
DWORD flags
);
Parameters
data | The raw MIDI data.
|
length | The length of the data.
|
events | Pointer to an array to receive the events... NULL = get the number of events without getting the events themselves.
|
count | The maximum number of events to convert.
|
flags | A combination of these flags.
BASS_MIDI_EVENTS_NORSTATUS | Disable running status, meaning each event must include a status byte.
| BASS_MIDI_EVENTS_TIME | The raw MIDI data includes delta-time info.
|
|
Return value
If successful, the number of events processed is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Error codes
BASS_ERROR_MEM | There is insufficient memory.
|
BASS_ERROR_UNKNOWN | Some mystery problem!
|
Remarks
The MIDI port meta-event (21h) is supported, allowing access to more than the standard 16 channels: port 0 = channels 1-16, port 1 = channels 17-32, etc. Up to 8 ports are supported for a maximum of 128 channels, with any higher ports being mapped to port 0 (channels 1-16).
Example
Convert some raw MIDI data.
BYTE data[7] = {0x90, 60, 100, 64, 100, 67, 100}; // the event data
BASS_MIDI_EVENTS events[3];
BASS_MIDI_ConvertEvents(data, 7, events, 3, 0); // convert the events
Convert the same data with delta-time info.
BYTE data[10] = {0, 0x90, 60, 100, 0, 64, 100, 0, 67, 100}; // the event data
BASS_MIDI_EVENTS events[3];
BASS_MIDI_ConvertEvents(data, 10, events, 3, BASS_MIDI_EVENTS_TIME); // convert the events
See also
BASS_MIDI_StreamCreate, BASS_MIDI_StreamEvent, BASS_MIDI_StreamGetEvent