BASS.NET API for the Un4seen BASS Audio Library

BassBASS_ChannelGetLevels Method

BASS.NET API for the Un4seen BASS Audio Library
Retrieves the level (peak amplitude) of a sample, stream, MOD music or recording channel.

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

public static float[] BASS_ChannelGetLevels(
	int handle,
	float length = 0,02f,
	BASSLevel flags = BASSLevel.BASS_LEVEL_ALL
)

Parameters

handle
Type: SystemInt32
The channel handle... a HCHANNEL, HMUSIC, HSTREAM, or HRECORD.
length (Optional)
Type: SystemSingle
How much data (in seconds) to look at to get the level.
flags (Optional)
Type: Un4seen.BassBASSLevel
What levels to retrieve. One of the following (see BASSLevel):
BASS_LEVEL_ALLRetrieves a separate level for each channel.
BASS_LEVEL_MONORetrieve a single mono level.
BASS_LEVEL_STEREOGet a stereo level. The left level will be from the even channels, and the right level will be from the odd channels. If there are an odd number of channels then the left and right levels will both include all channels.
BASS_LEVEL_RMSFlag: Get the RMS level. Otherwise the peak level.
BASS_LEVEL_VOLPANApply the current BASS_ATTRIB_VOL and BASS_ATTRIB_PAN values to the level reading.
BASS_LEVEL_NOREMOVEDo not remove the inspected data from a (recording) channel's buffer. This is automatic if the recording channel is using a RECORDPROC callback function. This flag is ignored on other channel types.

Return Value

Type: Single
On success the array of levels is returned - else is returned, use BASS_ErrorGetCode to get the error code.
Remarks

This function operates in the same way as BASS_ChannelGetLevel(Int32) but has greater flexibility on how the level is measured. The levels are not clipped, so may exceed +/-1.0 on floating-point channels.

ERROR CODEDescription
BASS_ERROR_HANDLEhandle is not a valid channel.
BASS_ERROR_NOPLAYThe channel is not playing.
BASS_ERROR_ENDEDThe decoding channel has reached the end.
BASS_ERROR_BUFLOSTShould not happen... check that a valid window handle was used with BASS_Init(Int32, Int32, BASSInit, IntPtr, IntPtr).

See Also

Reference