IAudioClockAdjustment::SetSampleRate method (audioclient.h)

The SetSampleRate method sets the sample rate of a stream.

Syntax

HRESULT SetSampleRate(
  [in] float flSampleRate
);

Parameters

[in] flSampleRate

The new sample rate in frames per second.

Return value

If the method succeeds, it returns S_OK.

Return code Description
AUDCLNT_E_NOT_INITIALIZED
The audio stream has not been successfully initialized.
E_INVALIDARG
The sample rate is out of the range for the Audio Processing Object.

Remarks

This method must not be called from a real-time processing thread.

The new sample rate will take effect after the current frame is done processing and will remain in effect until SetSampleRate is called again. The audio client must be initialized in shared-mode (AUDCLNT_SHAREMODE_SHARED), otherwise SetSampleRate fails.

Requirements

Requirement Value
Minimum supported client Windows 7 [desktop apps only]
Minimum supported server Windows Server 2008 R2 [desktop apps only]
Target Platform Windows
Header audioclient.h

See also

AUDCLNT_STREAMFLAGS_XXX Constants

IAudioClockAdjustment