BASS.NET API for the Un4seen BASS Audio Library

BassMidiBASS_MIDI_StreamEvents Method (Int32, BASSMIDIEventMode, Int32, Byte)

BASS.NET API for the Un4seen BASS Audio Library
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,
	byte[] events
)

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_RAWRaw 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_STRUCTAn array of BASS_MIDI_EVENT structures.
BASS_MIDI_EVENTS_NORSTATUSFlag: Disable running status, meaning each event must include a status byte. Only applicable with BASS_MIDI_EVENTS_RAW.
BASS_MIDI_EVENTS_SYNCFlag: 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: SystemByte
The event data (raw MIDI event data, as would be sent to a MIDI device).

Return Value

Type: Int32
If 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 CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_ILLPARAMflags is not valid.

See Also

Reference