BASS_ASIO_ChannelGetLevel


Retrieves the level (peak amplitude) of a channel.

float BASS_ASIO_ChannelGetLevel(
    BOOL input,
    DWORD channel
);

Parameters

inputDealing with an input channel? FALSE = an output channel.
channelThe input/output channel number... 0 = first.

Return value

If an error occurs, -1 is returned, use BASS_ASIO_ErrorGetCode to get the error code. If successful, the level of the channel is returned, ranging from 0 (silent) to 1 (max). If the channel's native sample format is floating-point, it is actually possible for the level to go above 1.

Error codes

BASS_ERROR_INITBASS_ASIO_Init has not been successfully called.
BASS_ERROR_ILLPARAMThe input and channel combination is invalid.
BASS_ERROR_STARTThe device has not been started, or the channel is not enabled.
BASS_ERROR_FORMATLevel retrieval is not supported for the channel's sample format.

Remarks

This function measures the current level of a single channel, and is not affected by any other channels that are joined with it.

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.

Example

Get the level of the first output channel in decibels.
float level=BASS_ASIO_ChannelGetLevel(FALSE, 0); // get the linear level
float dblevel=(level>0?20*log10(level):-1000); // translate it to dB

See also

BASS_ASIO_ChannelGetVolume, BASS_ASIO_ChannelIsActive, BASS_ASIO_ChannelSetVolume