ISpatialAudioObjectForHrtf::SetGain method (spatialaudiohrtf.h)

Sets the gain for the ISpatialAudioObjectForHrtf in dB.

Syntax

HRESULT SetGain(
  [in] float gain
);

Parameters

[in] gain

The gain for the ISpatialAudioObjectForHrtf in dB.

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 code Description
SPTLAUDCLNT_E_OUT_OF_ORDER

ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects was not called before the call to SetGain.

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 ISpatialAudioObjectRenderStreamBase::BeginUpdatingAudioObjects and ISpatialAudioObjectRenderStreamBase::EndUpdatingAudioObjects).

Remarks

This is valid only for spatial audio objects configured to use the SpatialAudioHrtfDistanceDecay_CustomDecay decay type. Set the decay type of an ISpatialAudioObjectForHrtf object by calling SetDistanceDecay. Set the default decay type for an all objects in an HRTF render stream by setting the DistanceDecay field of the SpatialAudioHrtfActivationParams passed into ISpatialAudioClient::ActivateSpatialAudioStream.

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

Requirements

Requirement Value
Target Platform Windows
Header spatialaudiohrtf.h

See also

ISpatialAudioObjectForHrtf