Copyright © 2001-2016 MultiMedia Soft

StreamVolumeDirectSoundBufferSet method

Previous pageReturn to chapter overviewNext page



Changes the volume for the given player directly on the DirectSound buffer: changing this volume will not affect the volume of other players. The current volume applied to the DirectSound buffer can be retrieved through the StreamVolumeDirectSoundBufferGet 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.


Due to the fact that this method acts directly at DirectSound level and not at mixing level, when applied to a custom stream mixer, created using the StreamMixerCreate method having the nOutput parameter set to a value different from -1, the volume change affects the audio stream being sent to the sound card speakers but doesn't affect the audio streams eventually sent to the recorder control or to a streaming server.

If you want to apply a volume level that will work at mixing level inside the custom stream mixer, affecting all of the outgoing audio streams, you should use StreamVolumeLevelSet method,


See the How to use custom Stream Mixers tutorial for further details about stream mixers.





[Visual Basic]

control.StreamVolumeDirectSoundBufferSet (

nPlayer as Integer,

fValue as single,

nScaleType as enumVolumeScales

) as enumErrorCodes



short control.StreamVolumeDirectSoundBufferSet (

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