Copyright © 2005-2019 MultiMedia Soft

StreamVolumeLevelSet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Changes the volume for the given player: changing this volume will not affect the volume of other players. The current volume can be retrieved through the StreamVolumeLevelGet method.

 

This method is ignored and returns a ERR_PLAYER_BUSY error when called during a volume sliding started by a volume automation procedure or by the embedded fader.

 

 

Important change affecting backward compatibility when dealing with DirectSound drivers

 

Till version 5.x of the component, this method was used to set the volume directly on the DirectSound buffer used for performing playback, allowing a smaller latency on volume changes. Starting from version 6.0 of the component, the volume set through this method no more applies to the DirectSound buffer directly but only to the internal volume-related DSP used for volume sliding purposes, so the volume change will be affected by the DirectSound latency.

In order to continue setting the volume directly on the DirectSound buffer as seen for versions till 5.x, you should change your existing source code and use the new StreamVolumeDirectSoundBufferSet method in place of the StreamVolumeLevelSet method.

 

 

 

Syntax

 

[Visual Basic]

Public Function StreamVolumeLevelSet (

nPlayerIndex as Int16,

fValue as float,

nScaleType as enumVolumeScales

) as enumErrorCodes


 

[C#]

public enumErrorCodes StreamVolumeLevelSet (

Int16 nPlayerIndex,

float fValue,

enumVolumeScales nScaleType

);


 

[C++]

public: enumErrorCodes StreamVolumeLevelSet (

Int16 nPlayerIndex,

float fValue,

enumVolumeScales nScaleType

);


 

 

Parameter

Description

 

 

nPlayerIndex

Number representing the zero-based index of the involved player

fValue

Number representing the new volume (the meaning of the passed value depends upon the nScaleType parameter).

nScaleType

The volume scaling type.

Supported values are the following:

Mnemonic value

Value

Meaning

SCALE_LINEAR

0

The passed volume is based upon a linear scale and can be in the range from 0.0 (silence) to 100.0 (max volume)

SCALE_LOG

1

The passed volume, expressed in dB, is 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 volume into a logarithmic volume is the following:

VolumeInDB = 20 * log10 (VolumeLinear/100)

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

VolumeLinear = 100 * pow (10, VolumeInDB/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.