Copyright © 2008-2019 MultiMedia Soft

StreamPeakLevelsGet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Retrieves peak levels on the current playback position using the specified scale.

The VUMeterValueChange event is used for the purpose of retrieving peak levels of the audio stream during playback: this method can be used as an integration of the existing VUMeterValueChange event in order to retrieve peak levels for various channels of a multi-channel audio stream: a good place to invoke this method is indeed inside the event handler function of the VUMeterValueChange event.

 

 

Syntax

 

[Visual Basic]

control.StreamPeakLevelsGet (

tPeakLevels as Single,

nLengthInMs as Long,

bRms as enumBoolean,

bStereo as enumBoolean,

nScaleType as enumVolumeScales

) as enumErrorCodes


 

[C++]

short control.StreamPeakLevelsGet (

float *tPeakLevels,

long nLengthInMs,

short bRms,

short bStereo,

short 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

BOOL_FALSE

Use peak levels.

BOOL_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

BOOL_FALSE

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

BOOL_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.ERR_NOERROR (0)

The volume has been changed correctly