BASS.NET API for the Un4seen BASS Audio LibraryBassMidiBASS_MIDI_StreamGetChannel Method BASS.NET API for the Un4seen BASS Audio Library
Gets a HSTREAM handle for a MIDI channel (e.g. to set DSP/FX on individual MIDI channels).

Namespace: Un4seen.Bass.AddOn.Midi
Assembly: Bass.Net (in Bass.Net.dll) Version:

public static int BASS_MIDI_StreamGetChannel(
	int handle,
	int channel


Type: SystemInt32
The midi stream to get a channel from.
Type: SystemInt32
The MIDI channel... 0 = channel 1. Or one of the following special channels:

BASS_MIDI_CHAN_CHORUS = -1 : Chorus mix channel. The default chorus processing is replaced by the stream's processing.

BASS_MIDI_CHAN_REVERB = -2 : Reverb mix channel. The default reverb processing is replaced by the stream's processing.

BASS_MIDI_CHAN_USERFX = -3 : User effect mix channel.

Return Value

Type: Int32
If successful, the channel handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

By default, MIDI channels do not have streams assigned to them; a MIDI channel only gets a stream when this function is called, which it then keeps until the MIDI stream is freed. MIDI channel streams can also be freed before then via BASS_StreamFree(Int32). Each MIDI channel stream increases the CPU usage slightly, even if there are no DSP/FX set on them, so for optimal performance they should not be activated when unnecessary

The MIDI channel streams have a different path to the final mix than the BASSMIDI reverb/chorus processing, which means that the reverb/chorus will not be present in the data received by any DSP/FX set on the streams and nor will the reverb/chorus be applied to the DSP/FX output; the reverb/chorus processing will use the channel's original data.

The MIDI channel streams can only be used to set DSP/FX on the channels. They cannot be used with BASS_ChannelGetData(Int32, IntPtr, Int32) or BASS_ChannelGetLevel(Int32) to visualise the channels, for example, but that could be achieved via a DSP function instead.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_NOTAVAILchannel is not valid.


Apply some DX8 distortion to channel 1 of a MIDI stream:
' get a stream for MIDI channel 1
Dim chan1 As Integer = BassMidi.BASS_MIDI_StreamGetChannel(midi, 0)
' set the DX8 distortion effect on it
Dim chan1 As Integer = Bass.BASS_ChannelSetFX(chan1, BASSFXType.BASS_FX_DX8_DISTORTION, 0)
// get a stream for MIDI channel 1
int chan1 = BassMidi.BASS_MIDI_StreamGetChannel(midi, 0);
// set the DX8 distortion effect on it
int fx = Bass.BASS_ChannelSetFX(chan1, BASSFXType.BASS_FX_DX8_DISTORTION, 0);
See Also