Assembly: Bass.Net (in Bass.Net.dll) Version: 22.214.171.124
[DllImportAttribute("bass")] public static int BASS_ChannelGetLevel( int handle )
<DllImportAttribute("bass">] Public Shared Function BASS_ChannelGetLevel ( handle As Integer ) As Integer
- Type: SystemInt32
The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD.
Return ValueType: Int32
If an error occurs, -1 is returned, use BASS_ErrorGetCode to get the error code.
If successful, the level of the left channel is returned in the low word (low 16-bits, use LowWord32(Int32)), and the level of the right channel is returned in the high word (high 16-bits, use HighWord32(Int32)). If the channel is mono, then the low word is duplicated in the high word. The level ranges linearly from 0 (silent) to 32768 (max). 0 will be returned when a channel is stalled.
This function measures the level of the channel's sample data, not the level of the channel in the final output mix, so the channel's volume and panning/balance (as set with BASS_ChannelSetAttribute(Int32, BASSAttribute, Single), BASS_ATTRIB_VOL or BASS_ATTRIB_PAN) does not affect it. The effect of any DSP/FX set on the channel is present in the measurement, except for DX8 effects when using the "With FX flag" DX8 effect implementation.
For channels that are more than stereo, the left level will include all left channels (eg. front-left, rear-left, center), and the right will include all right (front-right, rear-right, LFE). If there are an odd number of channels then the left and right levels will include all channels. If the level of each individual channel is required, that is available from the other overload(s).
20ms of data is inspected to calculate the level. When used with a decoding channel, that means 20ms of data needs to be decoded from the channel in order to calculate the level, and that data is then gone, eg. it is not available to a subsequent BASS_ChannelGetData(Int32, IntPtr, Int32) call.
|BASS_ERROR_HANDLE||handle is not a valid channel.|
|BASS_ERROR_NOPLAY||The channel is not playing.|
|BASS_ERROR_ENDED||The decoding channel has reached the end.|
|BASS_ERROR_BUFLOST||Should not happen... check that a valid window handle was used with.|
Dim level As Integer = Bass.BASS_ChannelGetLevel(channel) Dim left As Integer = Utils.LowWord32(level) ' the left level Dim right As Integer = Utils.HighWord32(level) ' the right level
int level = Bass.BASS_ChannelGetLevel(channel); int left = Utils.LowWord32(level); // the left level int right = Utils.HighWord32(level); // the right level