Retrieves a portion of the events in a MIDI stream.

DWORD BASS_MIDI_StreamGetEventsEx(
    HSTREAM handle,
    int track,
    DWORD filter,
    BASS_MIDI_EVENT *events,
    DWORD start,
    DWORD count


handleThe MIDI stream to get the events from.
trackThe track to get the events from... 0 = 1st track, -1 = all tracks.
filterThe type of events to retrieve... 0 = all events. See BASS_MIDI_StreamEvent for a list of possible event types.
eventsPointer to an array to receive the events... NULL = get the number of events available in the specified range without getting the events themselves.
startThe first event to retrieve.
countThe maximum number of events to retrieve.

Return value

If successful, the number of events is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILThe stream does not have an event sequence.
BASS_ERROR_ILLPARAMtrack is not valid.


This function is identical to BASS_MIDI_StreamGetEvents except that it can retrieve a portion of the events instead of all of them.


Retrieve the first 10 events in the 1st track.
BASS_MIDI_EVENT events[10]; // event array
DWORD eventc = BASS_MIDI_StreamGetEvents(handle, 0, 0, events, 0, 10); // get the events

See also

BASS_MIDI_StreamCreateFile, BASS_MIDI_StreamGetEvent, BASS_MIDI_StreamGetEvents, BASS_MIDI_EVENT structure