ISpatialAudioObject::SetVolume method

Sets an audio amplitude multiplier that will be applied to the audio data provided by the ISpatialAudioObject before it is submitted to the audio rendering engine.

Syntax


HRESULT SetVolume(
  [infloat volume
);

Parameters

volume [in]

The amplitude multiplier for audio data. This must be a value between 0.0 and 1.0.

Return value

If the method succeeds, it returns S_OK. If it fails, possible return codes include, but are not limited to, the values shown in the following table.

Return codeDescription
SPTLAUDCLNT_E_OUT_OF_ORDER

ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects was not called before the call to SetVolume.

SPTLAUDCLNT_E_RESOURCES_INVALIDATED

SetEndOfStream was called either explicitly or implicitly in a previous audio processing pass. SetEndOfStream is called implicitly by the system if GetBuffer is not called within an audio processing pass (between calls to ISpatialAudioObjectRenderStream::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStream::EndUpdatingAudioObjects).

 

Remarks

If SetVolume is never called, the default value of 1.0 is used. After SetVolume is called, the volume that is set will be used for the audio object until the volume is changed with another call to SetVolume.

Requirements

Header

Spatialaudioclient.h

See also

ISpatialAudioObject

 

 

Show: