BASS MIDI

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

dataThe raw MIDI data.
lengthThe length of the data.
eventsPointer to an array to receive the events... NULL = get the number of events without getting the events themselves.
countThe maximum number of events to convert.
flagsA combination of these flags.
BASS_MIDI_EVENTS_NORSTATUSDisable running status, meaning each event must include a status byte.
BASS_MIDI_EVENTS_TIMEThe 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_MEMThere is insufficient memory.
BASS_ERROR_UNKNOWNSome mystery problem!

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