IAudioClock::GetFrequency Method

The GetFrequency method gets the device frequency.

Syntax

public:
HRESULT GetFrequency(
         UINT64 *pu64Frequency
)  

Parameters

pu64Frequency
Type: UINT64 *

[out]

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

Return value

Type: HRESULT 

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 codes
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 audio service is not running.

Refer to WASAPI error codes.

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.

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

Header: Declared in audioclient.h.

Library: Use mmdevapi.lib.

See also

IAudioClock

IAudioClock Members