Copyright © 2001-2018 MultiMedia Soft

StreamVolumeLevelSet method

Previous pageReturn to chapter overviewNext page



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 6.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 7.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 6.x, you should change your existing source code and use the new StreamVolumeDirectSoundBufferSet method in place of the StreamVolumeLevelSet method.






[Visual Basic]

control.StreamVolumeLevelSet (

nPlayer as Integer,

fValue as single,

nScaleType as enumVolumeScales

) as enumErrorCodes



short control.StreamVolumeLevelSet (

short nPlayer,

float fValue,

short nScaleType









Number representing the zero-based index of the player whose volume will change


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


The volume scaling type.

Supported values are the following:

Mnemonic constant





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



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






Negative value

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

enumErrorCodes.ERR_NOERROR (0)

The volume has been changed correctly