BASS_MIDI_StreamGetChannel

Retrieves a MIDI channel's stream handle, which can be used to set DSP/FX on it. Can also replace the default reverb and chorus processing.

HSTREAM BASS_MIDI_StreamGetChannel(
    HSTREAM handle,
    DWORD chan
);

Parameters

handleThe MIDI stream.
chanThe MIDI channel... 0 = channel 1. Or one of the following special channels.
BASS_MIDI_CHAN_CHORUSChorus mix channel. The default chorus processing is replaced by the stream's processing.
BASS_MIDI_CHAN_REVERBReverb mix channel. The default reverb processing is replaced by the stream's processing.
BASS_MIDI_CHAN_USERFXUser effect mix channel.

Return value

If successful, the MIDI channel's stream handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not valid.
BASS_ERROR_ILLPARAMchan is not valid.

Remarks

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. 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 unnecessarily.

A MIDI channel stream receives the channel's dry mix, and its output is then sent through the normal reverb/chorus/userfx processing, but drum key reverb/chorus/userfx settings get ignored as it is impossible to apply different reverb/chorus/userfx levels to individual keys in this case (they have already been mixed).

MIDI channel streams can only be used to set DSP/FX on the channels. They cannot be used with BASS_ChannelGetData or BASS_ChannelGetLevel to visualise the channels, for example, but that could be achieved with a DSP function instead. A MIDI channel stream's sample format is always floating-point, regardless of the MIDI stream's sample format.

Example

Apply some DX8 distortion to channel 1 of a MIDI stream.
HSTREAM chan1 = BASS_MIDI_StreamGetChannel(midi, 0); // get a stream for MIDI channel 1
HFX fx = BASS_ChannelSetFX(chan1, BASS_FX_DX8_DISTORTION, 0); // set the DX8 distortion effect on it

See also

BASS_MIDI_StreamCreate, BASS_MIDI_StreamCreateFile

BASS_ChannelSetDSP, BASS_ChannelSetFX