BASS_MIDI_StreamGetEvent


Retrieves the current value of an event in a channel of a MIDI stream.

DWORD BASS_MIDI_StreamGetEvent(
    HSTREAM handle,
    DWORD chan,
    DWORD event
);

Parameters

handleThe MIDI stream to get the event value from.
chanThe MIDI channel to get the event value from... 0 = channel 1.
eventThe event value to retrieve. See BASS_MIDI_StreamEvent for details on the available event types and their values. With the MIDI_EVENT_NOTE, MIDI_EVENT_KEYPRES, MIDI_EVENT_SCALETUNING and drum key (MIDI_EVENT_DRUM_CUTOFF/etc) events, the HIWORD - use MAKELONG(event,key) - can be used to specify which key/note to get the value from. Special MIDI_EVENT_NOTES and MIDI_EVENT_VOICES events are also available to check how many keys are pressed and how many voices are active, respectively.

Return value

If successful, the event value is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_ILLPARAMOne of the other parameters is invalid.

Remarks

The MIDI_EVENT_NOTE event value will be 1 if the specified key is pressed and 0 if not. The MIDI_EVENT_NOTES event can be used to check how many keys in total are pressed in the specified channel. If a key is simultaneously pressed multiple times, it will still only be counted once.

Syncs can be used to be informed of when event values change.

See also

BASS_MIDI_StreamEvent, BASS_MIDI_StreamGetEvents