Retrieves the level of a channel.
float BASS_ASIO_ChannelGetLevel( BOOL input, DWORD channel );
input | Dealing with an input channel? FALSE = an output channel. |
channel | The input/output channel number... 0 = first. The BASS_ASIO_LEVEL_RMS flag can optionally be used to get the RMS level, otherwise the peak level is given. |
BASS_ERROR_INIT | BASS_ASIO_Init has not been successfully called. |
BASS_ERROR_ILLPARAM | The input and channel combination is invalid. |
BASS_ERROR_START | The device has not been started, or the channel is not enabled. |
BASS_ERROR_FORMAT | Level retrieval is not supported for the channel's sample format. |
Volume settings made via BASS_ASIO_ChannelSetVolume affect the level reading of output channels, but not input channels.
When an input channel is paused, it is still possible to get its current level. Paused output channels will have a level of 0.
Level retrieval is not supported when the sample format is DSD.
float level = BASS_ASIO_ChannelGetLevel(FALSE, 0); // get the linear level float dblevel = (level > 0 ? 20 * log10(level) : -HUGE_VAL); // translate it to dB
Get the RMS level of the first output channel in decibels.
float level = BASS_ASIO_ChannelGetLevel(FALSE, 0 | BASS_ASIO_LEVEL_RMS); // get the linear RMS level float dblevel = (level > 0 ? 20 * log10(level) : -HUGE_VAL); // translate it to dB