BASS.NET API for the Un4seen BASS Audio LibraryUtilsGetLevel2 Method (IntPtr, Int32, 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 long GetLevel2(
	IntPtr buffer,
	int chans,
	int bps,
	int startIndex,
	int length


Type: SystemIntPtr
The buffer pointer to the sample data (e.g. as obtained in a DSPPROC).
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 bytes per sample (or bitwidth) - which can be either 1, 2 or 4 bytes per sample or 8, 16 or 32 bits per sample.
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) - no range check is applied here!.

Return Value

Type: Int64
If successful, the level of the left channel is returned in the low Dword (low 32-bits), and the level of the right channel is returned in the high Dword (high 32-bits). Each Dword (32-bit) carries the maximum peak level value in the high word (high 16-bit) and the the minimum peak level value in the low word (low 16-bit). If the channel is mono, then the low Dword is duplicated in the high Dword.

Structure of one element (long = 64-bit):

|               64-bit              |
|      right       |      left      |

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

See Also