Copyright © 2006-2019 MultiMedia Soft

StreamPeakLevelsGet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Retrieves peak levels on the current playback position of the given player or stream mixer using the specified scale.

The VUMeterValueChange event is used for the purpose of retrieving peak levels of the audio stream during recording/playback: this method can be used as an integration of the existing VUMeterValueChange event in order to obtain RMS (Root-Mean-Square) levels: a good place to invoke this method is indeed inside the event handler function of the VUMeterValueChange event.

 

 

Syntax

 

[Visual Basic]

Public StreamPeakLevelsGet (

tPeakLevels() as Single,

nLengthInMs as Int32,

bRms as Boolean,

bStereo as Boolean,

nScaleType as enumVolumeScales

) as enumErrorCodes


 

[C#]

public enumErrorCodes StreamPeakLevelsGet (

float[] tPeakLevels,

Int32 nLengthInMs,

bool bRms,

bool bStereo,

enumVolumeScales nScaleType

);


 

[C++]

public: enumErrorCodes StreamPeakLevelsGet (

float[] tPeakLevels,

Int32 nLengthInMs,

bool bRms,

bool bStereo,

enumVolumeScales nScaleType

);


 

 

Parameter

Description

 

 

tPeakLevels

Table that, on return from the method call, will contain floating point values representing detected peak levels for each of the audio stream's channels.

In order to avoid issues, the size of this table should be adapted to the possibility to store up to 8 channels.

nLengthInMs

The amount of data to inspect to calculate the peak level, expressed in milliseconds. The maximum value is 1000.

bRms

Boolean value indicating if values to retrieve are RMS (Root-Mean-Square) levels or peak levels.

Supported values are the following:

Mnemonic constant

Meaning

false

Use peak levels.

true

Use RMS levels.

bStereo

Boolean value indicating if values to retrieve should be considered as mono or stereo levels.

Supported values are the following:

Mnemonic constant

Meaning

false

Get mono levels, allowing to retrieve a separate level for each channel.

true

Get stereo levels meaning that 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.

nScaleType

The scaling type of values reported into the tPeakLevels table.

Supported values are the following:

Mnemonic constant

Value

Meaning

SCALE_LINEAR

0

Returned values are based upon a linear scale and can be in the range from 0.0 (silence) to 100.0 (max volume)

SCALE_LOG

1

Returned values, expressed in dB, are based upon a logarithmic scale and can be in the range from -100  (silence) to 0 (max volume)

The actual applied formula for converting a linear value into a logarithmic value is the following:

ValueInDB = 20 * log10 (ValueLinear/100)

The C syntax for converting a logarithmic value into a linear value is the following:

ValueLinear = 100 * pow (10, ValueInDB/20);

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.NOERROR (0)

The method call was successful.