BASS.NET API for the Un4seen BASS Audio LibraryBassAsioBASS_ASIO_ChannelGetLevel Method BASS.NET API for the Un4seen BASS Audio Library
Retrieves the level (peak amplitude) of a channel.

Namespace: Un4seen.BassAsio
Assembly: Bass.Net (in Bass.Net.dll) Version:

public static float BASS_ASIO_ChannelGetLevel(
	bool input,
	int channel


Type: SystemBoolean
Dealing with an input channel? = an output channel.
Type: SystemInt32
The input/output channel number... 0 = first.

Return Value

Type: Single
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.

This function measures the 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(Boolean, Int32, Single) affect the level reading of output channels, but not input channels.

When an input channel is paused, it is still possible to get its level. Paused output channels will have a level of 0.

Level retrieval is not supported when the sample format is DSD.

ERROR CODEDescription
BASS_ERROR_INITBASS_ASIO_Init(Int32, BASSASIOInit) has not been successfully called.
BASS_ERROR_ILLPARAMThe input and channel combination is invalid.
BASS_ERROR_STARTThe device hasn't been started, or the channel isn't enabled.
BASS_ERROR_FORMATLevel retrieval is not supported for the channel's sample format (please report).


' get the linear level
Dim level As Single = BassAsio.BASS_ASIO_ChannelSetVolume(False, 0)
' translate it to logarithmic dB 
Dim db As Double = 20.0 * Math.Log10(level)
// get the linear level
float level = BassAsio.BASS_ASIO_ChannelSetVolume(false, 0);
// translate it to logarithmic dB 
double db = 20.0 * Math.Log10(level);
See Also