Retrieves the level of a mixer source channel.

BOOL BASS_Mixer_ChannelGetLevelEx(
    BOOL handle,
    float *levels,
    float length,
    DWORD flags


handleThe channel handle.
levelsAn array to receive the levels.
lengthThe amount of data to inspect to calculate the level, in seconds. The maximum is 1 second. Less data than requested may be used if the full amount is not available, eg. if the source's buffer (determined by the BASS_CONFIG_MIXER_BUFFER config option) is shorter.
flagsA combination of these flags.
BASS_LEVEL_MONOGet a mono level. If neither this or the BASS_LEVEL_STEREO flag is used, then a separate level is retrieved for each channel.
BASS_LEVEL_STEREOGet a stereo level. The left level will be from the even channels, and the right level will be from the odd channels. If there are an odd number of channels then the left and right levels will both include all channels.
BASS_LEVEL_RMSGet the RMS level. Otherwise the peak level.
BASS_LEVEL_VOLPANApply the current BASS_ATTRIB_VOL and BASS_ATTRIB_PAN values and volume and pan envelopes to the level reading. Due to buffering, these values might not be the same as they were when the currently heard data was mixed.

Return value

If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.

Error codes

BASS_ERROR_HANDLEhandle is not a mixer source.
BASS_ERROR_ILLPARAMlength is not valid.
BASS_ERROR_NOTAVAILThe channel does not have buffering enabled.
BASS_ERROR_NOPLAYThe mixer is not playing.


This function operates in the same way as BASS_Mixer_ChannelGetLevel but has greater flexibility on how the level is measured. The levels are not clipped, so may exceed +/-1.0 on floating-point channels.

See also

BASS_Mixer_ChannelGetData, BASS_Mixer_ChannelGetLevel, BASS_Mixer_ChannelIsActive, BASS_ATTRIB_MIXER_LATENCY, BASS_CONFIG_MIXER_BUFFER