Retrieves the level (peak amplitude) of a sample, stream, MOD music, or recording channel.
DWORD BASS_ChannelGetLevel( DWORD handle );
handle | The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD. |
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. |
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 BASS_ChannelGetLevelEx.
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 call.
More flexible level retrieval is available with BASS_ChannelGetLevelEx.
DWORD level, left, right; level = BASS_ChannelGetLevel(channel); left = LOWORD(level); // the left level right = HIWORD(level); // the right level