IAudioClient::GetStreamLatency method (audioclient.h)
The GetStreamLatency method retrieves the maximum latency for the current stream and can be called any time after the stream has been initialized.
Syntax
HRESULT GetStreamLatency(
[out] REFERENCE_TIME *phnsLatency
);
Parameters
[out] phnsLatency
Pointer to a REFERENCE_TIME variable into which the method writes a time value representing the latency. The time is expressed in 100-nanosecond units. For more information about REFERENCE_TIME, see the Windows SDK documentation.
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 |
---|---|
|
The audio stream has not been successfully initialized. |
|
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. |
|
The Windows audio service is not running. |
|
Parameter phnsLatency is NULL. |
Remarks
This method requires prior initialization of the IAudioClient interface. All calls to this method will fail with the error AUDCLNT_E_NOT_INITIALIZED until the client initializes the audio stream by successfully calling the IAudioClient::Initialize method.
This method retrieves the maximum latency for the current stream. The value will not change for the lifetime of the IAudioClient object.
Rendering clients can use this latency value to compute the minimum amount of data that they can write during any single processing pass. To write less than this minimum is to risk introducing glitches into the audio stream. For more information, see IAudioRenderClient::GetBuffer.
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 |