BASS_Mixer_StreamCreate
Creates a mixer stream.
HSTREAM BASS_Mixer_StreamCreate( DWORD freq, DWORD chans, DWORD flags );
Parameters
freq | The sample rate of the mixer output. | ||||||||||||||||||||||||
chans | The number of channels... 1 = mono, 2 = stereo, 4 = quadraphonic, 6 = 5.1, 8 = 7.1. | ||||||||||||||||||||||||
flags | Any combination of these flags.
|
Return value
If successful, the new stream's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.Error codes
BASS_ERROR_INIT | BASS_Init has not been successfully called. |
BASS_ERROR_NOTAVAIL | Only decoding channels (BASS_STREAM_DECODE) are allowed when using the "no sound" device. The BASS_STREAM_AUTOFREE flag is also unavailable to decoding channels. |
BASS_ERROR_FORMAT | The sample format is not supported by the device/drivers. If the stream is more than stereo or the BASS_SAMPLE_FLOAT flag is used, it could be that they are not supported. |
BASS_ERROR_SPEAKER | The specified SPEAKER flags are invalid. The device/drivers do not support them, they are attempting to assign a stereo stream to a mono speaker or 3D functionality is enabled. |
BASS_ERROR_MEM | There is insufficient memory. |
BASS_ERROR_NO3D | Could not initialize 3D support. |
BASS_ERROR_UNKNOWN | Some other mystery problem! |
Remarks
Source channels are "plugged" into a mixer using the BASS_Mixer_StreamAddChannel or BASS_Mixer_StreamAddChannelEx functions, and "unplugged" using the BASS_Mixer_ChannelRemove function. Sources can be added and removed at any time, so a mixer does not have a predetermined length and BASS_ChannelGetLength is not applicable. Likewise, seeking is not possible, except to position 0, as described below.If the mixer output is being played (it is not a decoding channel), then there will be some delay in the effect of adding/removing source channels or changing their attributes being heard. This latency can be reduced by making use of the BASS_CONFIG_BUFFER and BASS_CONFIG_UPDATEPERIOD config options. The playback buffer can be flushed by calling BASS_ChannelPlay (restart = TRUE) or BASS_ChannelSetPosition (pos = 0). That can also be done to restart a mixer that has ended.
Unless the BASS_MIXER_END flag is specified, a mixer stream will never end. When there are no sources (or the sources have ended/stalled), it will produce no output until there is an active source. That is unless the BASS_MIXER_NONSTOP flag is used, in which case it will produce silent output while there are no active sources. The BASS_MIXER_END and BASS_MIXER_NONSTOP flags can be toggled at any time, using BASS_ChannelFlags.
Besides mixing channels, a mixer stream can be used for sample rate conversion. In that case the freq parameter would be set to the new sample rate, and the source channel's attributes would be left at their defaults. A mixer stream can also be used to downmix, upmix and generally rearrange channels, using the matrix mixing features.