BASS MIDI

BASS_ATTRIB_MIDI_STATE attribute


The current state of a MIDI stream.

BASS_ChannelSetAttributeEx(
    DWORD handle,
    BASS_ATTRIB_MIDI_STATE,
    void *state,
    DWORD size
);

Parameters

handleThe MIDI stream handle.
stateThe state data.
sizeThe size of the state data.

Remarks

This attribute includes the state of all events in all MIDI channels, except for MIDI_EVENT_NOTE (playing notes are not preserved) and MIDI_EVENT_TEMPO. BASS_MIDI_StreamGetEvent can be used to get the MIDI_EVENT_TEMPO event state.

The structure of the MIDI state data may change in future versions, so if the data is stored, be prepared for BASS_ChannelSetAttributeEx to fail when trying to apply it.

Example

Transfer the state from one MIDI stream to another.
DWORD size=BASS_ChannelGetAttributeEx(stream1, BASS_ATTRIB_MIDI_STATE, NULL, 0); // get the size
void *state=malloc(size); // allocate a buffer for the data
BASS_ChannelGetAttributeEx(stream1, BASS_ATTRIB_MIDI_STATE, state, size); // get the data
BASS_ChannelSetAttributeEx(stream2, BASS_ATTRIB_MIDI_STATE, state, size); // apply it to the other stream
free(state);

See also

BASS_ChannelGetAttributeEx, BASS_ChannelSetAttributeEx