BASS_Mixer_StreamAddChannel
Plugs a channel into a mixer.
BOOL BASS_Mixer_StreamAddChannel( HSTREAM handle, DWORD channel, DWORD flags );
Parameters
handle | The mixer handle. | ||||||||||||||||
channel | The handle of the channel to plug into the mixer... a HMUSIC, HSTREAM or HRECORD. | ||||||||||||||||
flags | Any combination of these flags.
|
Return value
If successful, then TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.Error codes
BASS_ERROR_HANDLE | At least one of handle and channel is not valid. |
BASS_ERROR_DECODE | channel is not a decoding channel. |
BASS_ERROR_ALREADY | channel is already plugged into a mixer. It must be unplugged first. |
BASS_ERROR_SPEAKER | The mixer does not support the requested speaker(s), or you are attempting to assign a stereo stream to a mono speaker. |
Remarks
Internally, a mixer will use the BASS_ChannelGetData function to get data from its source channels. That means that the source channels must be decoding channels (not using a RECORDPROC in the case of a recording channel). Plugging a channel into more than one mixer at a time is not possible because the mixers would be taking data away from each other. An advantage of this is that there is no need for a mixer's handle to be provided with the channel functions. It is actually possible to plug a channel into multiple mixers via the use of splitter streams.Channels are "unplugged" using the BASS_Mixer_ChannelRemove function. Channels are also automatically unplugged when they are freed.
When mixing a channel, the mixer makes use of the channel's freq/volume/pan attributes, as set with BASS_ChannelSetAttribute. The BASS_CONFIG_CURVE_VOL and BASS_CONFIG_CURVE_PAN config option settings are also used.
If a multi-channel stream has more channels than the mixer output, the extra channels will be discarded. For example, if a 5.1 stream is plugged into a stereo mixer, only the front-left/right channels will be retained. That is unless matrix mixing is used.
The mixer processing is performed in floating-point, so it makes sense (for both quality and efficiency reasons) for the source channels to be floating-point too, though they do not have to be. It is also more efficient if the source channels have the same sample rate as the mixer output because no sample rate conversion is required then. When sample rate conversion is required, windowed sinc interpolation is used and the source's BASS_ATTRIB_SRC attribute determines how many points/samples are used in that, as follows: 0 (or below) = 4 points, 1 = 8 points, 2 = 16 points, 3 = 32 points, 4 = 64 points, 5 = 128 points, 6 (or above) = 256 points. 8 points are used if the BASS_ATTRIB_SRC attribute is unavailable (old BASS version). A higher number of points results in better sound quality (less aliasing and smaller transition band in the low-pass filter), but also higher CPU usage.