IAudioClock::GetFrequency method (audioclient.h)

The GetFrequency method gets the device frequency.

Syntax

HRESULT GetFrequency(
  [out] UINT64 *pu64Frequency
);

Parameters

[out] pu64Frequency

Pointer to a UINT64 variable into which the method writes the device frequency. For more information, see Remarks.

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
E_POINTER
Parameter pu64Frequency is NULL.
AUDCLNT_E_DEVICE_INVALIDATED
The audio endpoint device has been unplugged, or the audio hardware or associated hardware resources have been reconfigured, disabled, removed, or otherwise made unavailable for use.
AUDCLNT_E_SERVICE_NOT_RUNNING
The Windows audio service is not running.

Remarks

The device frequency is the frequency generated by the hardware clock in the audio device. This method reports the device frequency in units that are compatible with those of the device position that the IAudioClock::GetPosition method reports. For example, if, for a particular stream, the GetPosition method expresses the position p as a byte offset, the GetFrequency method expresses the frequency f in bytes per second. For any stream, the offset in seconds from the start of the stream can always be reliably calculated as p/f regardless of the units in which p and f are expressed.

In Windows Vista, the device frequency reported by successive calls to GetFrequency never changes during the lifetime of a stream.

If the clock generated by an audio device runs at a nominally constant frequency, the frequency might still vary slightly over time due to drift or jitter with respect to a reference clock. The reference clock might be a wall clock or the system clock used by the QueryPerformanceCounter function. The GetFrequency method ignores such variations and simply reports a constant frequency. However, the position reported by the IAudioClient::GetPosition method takes all such variations into account to report an accurate position value each time it is called. For more information about QueryPerformanceCounter, see the Windows SDK documentation.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps | UWP apps]
Minimum supported server Windows Server 2008 [desktop apps | UWP apps]
Target Platform Windows
Header audioclient.h

See also

IAudioClock Interface

IAudioClock::GetPosition