Copyright © 2005-2018 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]

Public Function StreamVolumeDirectSoundBufferSet (

nPlayerIndex as Int16,

nVolume as float,

nScaleType as enumVolumeScales

) as enumErrorCodes



public enumErrorCodes StreamVolumeDirectSoundBufferSet (

Int16 nPlayerIndex,

float nVolume,

enumVolumeScales nScaleType




public: enumErrorCodes StreamVolumeDirectSoundBufferSet (

Int16 nPlayerIndex,

float nVolume,

enumVolumeScales nScaleType









Number representing the zero-based index of the involved player


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 value





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

The method call was successful.