Retrieves the level (peak amplitude) of a channel.
Namespace: Un4seen.BassAsio
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax
[DllImportAttribute("bassasio")] public static float BASS_ASIO_ChannelGetLevel( bool input, int channel )
Parameters
- input
- Type: SystemBoolean
Dealing with an input channel? = an output channel. - channel
- Type: SystemInt32
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.
Return Value
Type: SingleIf 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.
Remarks
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 CODE | Description |
---|---|
BASS_ERROR_INIT | BASS_ASIO_Init(Int32, BASSASIOInit) has not been successfully called. |
BASS_ERROR_ILLPARAM | The input and channel combination is invalid. |
BASS_ERROR_START | The device hasn't been started, or the channel isn't enabled. |
BASS_ERROR_FORMAT | Level retrieval is not supported for the channel's sample format (please report). |
Examples
// 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