Namespace: Un4seen.Bass.AddOn.Mix
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.2
Parameters
- handle
- Type: SystemInt32
The handle of the mixer source channel (which was add via BASS_Mixer_StreamAddChannel(Int32, Int32, BASSFlag) or BASS_Mixer_StreamAddChannel(Int32, Int32, BASSFlag) or BASS_Mixer_StreamAddChannelEx(Int32, Int32, BASSFlag, Int64, Int64)) beforehand).
Return Value
Type: Int32If an error occurs, -1 is returned, use BASS_ErrorGetCode to get the error code.
If successful, the level of the left channel is returned in the low word (low 16-bits, use LowWord32(Int32)), and the level of the right channel is returned in the high word (high 16-bits, use HighWord32(Int32)). If the channel is mono, then the low word is duplicated in the high word. The level ranges linearly from 0 (silent) to 32768 (max). 0 will be returned when a channel is stalled.
This function is like the standard BASS_ChannelGetLevel(Int32), but it gets the level from the channel's buffer instead of decoding data from the channel, which means that the mixer doesn't miss out on any data. In order to do this, the source channel must have buffering enabled, via the BASS_MIXER_CHAN_BUFFER flag.
If the mixer is being played by BASS, the returned level will be in sync with what is currently being heard from the mixer. If another output system is being used, the BASS_ATTRIB_MIXER_LATENCY option can be used to tell the mixer what the latency is so that it can be taken account of, otherwise the channel's most recent data will be used to get the level. The BASS_CONFIG_MIXER_BUFFER config option determines how far back the level will be available from, so it should be set high enough to cover any latency.
ERROR CODE | Description |
---|---|
BASS_ERROR_HANDLE | handle is not plugged into a mixer. |
BASS_ERROR_NOTAVAIL | The channel does not have buffering (BASS_MIXER_CHAN_BUFFER) enabled. |
BASS_ERROR_NOPLAY | The mixer is not playing. |
BassMix.BASS_Mixer_StreamAddChannel(mixer, channel, BASSFlag.BASS_MIXER_CHAN_BUFFER); int level = BassMix.BASS_Mixer_ChannelGetLevel(channel); int left = Utils.LowWord32(level); // the left level int right = Utils.HighWord32(level); // the right level