Applies any number of events to a MIDI stream (BASS_MIDI_EVENTS_RAW).
Namespace: Un4seen.Bass.AddOn.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
public static int BASS_MIDI_StreamEvents( int handle, BASSMIDIEventMode flags, int chan, IntPtr events, int length )
Parameters
- handle
- Type: SystemInt32
The MIDI stream to apply the events to (as returned by BASS_MIDI_StreamCreate(Int32, BASSFlag, Int32)). - flags
- Type: Un4seen.Bass.AddOn.MidiBASSMIDIEventMode
BASS_MIDI_EVENTS_RAW, with optional flags (see BASSMIDIEventMode):BASS_MIDI_EVENTS_RAW Raw MIDI event data, as would be sent to a MIDI device. Running status is supported. To overcome the 16 channel limit, the event data's channel information can optionally be overridden by adding the new channel number to this parameter, where +1 = the 1st channel. BASS_MIDI_EVENTS_STRUCT An array of BASS_MIDI_EVENT structures. BASS_MIDI_EVENTS_NORSTATUS Flag: Disable running status, meaning each event must include a status byte. Only applicable with BASS_MIDI_EVENTS_RAW. BASS_MIDI_EVENTS_SYNC Flag: Trigger BASS_SYNC_MIDI_xxx syncs for the processed events (see BASS_ChannelSetSync(Int32, BASSSync, Int64, SYNCPROC, IntPtr)). - chan
- Type: SystemInt32
To overcome the 16 channel limit, the event data's channel information can optionally be overridden by adding the new channel number to this parameter, where 1 = the 1st channel - else leave to 0. - events
- Type: SystemIntPtr
The pointer to the event data (e.g. as received in a MIDIINPROC). - length
- Type: SystemInt32
The number of bytes contained in the events.
Return Value
Type: Int32If successful, the number of events processed is returned, else -1 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks
Events applied to a MIDI file stream can subsequently be overridden by events in the file itself, and will also be overridden when seeking or looping. That can be avoided by using additional channels, allocated via the BASS_ATTRIB_MIDI_CHANS attribute.
If the MIDI stream is being played (it's not a decoding channel), then there will be some delay in the effect of the event being heard. This latency can be reduced by making use of the BASS_CONFIG_BUFFER and BASS_CONFIG_UPDATEPERIOD config options when creating the stream.
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_ILLPARAM | flags is not valid. |
See Also