Retrieves the level (peak amplitude) of a mixer source channel.
DWORD BASS_Mixer_ChannelGetLevel( DWORD handle );
handle | The channel handle. |
BASS_ERROR_HANDLE | handle is not a mixer source. |
BASS_ERROR_NOTAVAIL | The channel does not have buffering enabled. |
BASS_ERROR_NOPLAY | The mixer is not playing. |
This function measures the level of the channel's sample data, not its level in the mixer output. It includes the effect of any DSP/FX set on the channel, but not the effect of the channel's BASS_ATTRIB_VOL or BASS_ATTRIB_PAN attributes or matrix mixing or any envelope set via BASS_Mixer_ChannelSetEnvelope.
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.
If the mixer is a submixer (source of another mixer) without its own latency set via the BASS_ATTRIB_MIXER_LATENCY option then the parent mixer's latency will be used. If the parent mixer is also a submixer then the process will be repeated, and so on, until a final latency value is obtained (if possible). This is only possible if the submixer(s) have the BASS_MIXER_POSEX flag set, to enable keeping a record of source positions.
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.
More flexible level retrieval is available with BASS_Mixer_ChannelGetLevelEx.