BASS.NET API for the Un4seen BASS Audio LibraryUtilsGetLevel Method (Byte, Int32, Int32, Int32)BASS.NET API for the Un4seen BASS Audio Library
Equivalent to BASS_ChannelGetLevel(Int32), but with individual offset and length.

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

public static int GetLevel(
	byte[] buffer,
	int chans,
	int startIndex,
	int length


Type: SystemByte
The 8-bit buffer to get the level from.
Type: SystemInt32
The number of channels to use (1=mono, 2=stereo). In case of mono the left and right channel will contain the same value.
Type: SystemInt32
The starting index (sample offset, not byte offset!) within the buffer from where to to get the level (use -1 to start from the beginning).
Type: SystemInt32
Number of samples (not bytes!) to use (startIndex + length must be less than the buffer size, use -1 to scan the whole buffer size).

Return Value

Type: Int32
If successful, the level of the left channel is returned in the low word (low 16-bits), and the level of the right channel is returned in the high word (high 16-bits). If the channel is mono, then the low word is duplicated in the high word.

Structure of the return value (int = 32-bit):

|               32-bit              |
|    right-peak    |   left-peak    |

Each peak level ranges linearly from 0 (silent) to +32767 (max).

See Also