Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

IXAudio2SourceVoice::GetState method

Returns the voice's current cursor position data.


void GetState(
             XAUDIO2_VOICE_STATE *pVoiceState,
  [optional] UINT32              Flags



Pointer to an XAUDIO2_VOICE_STATE structure containing the state of the voice.

Flags [optional]

Flags controlling which voice state data should be returned. Valid values are 0 or XAUDIO2_VOICE_NOSAMPLESPLAYED. The default value is 0. If you specify XAUDIO2_VOICE_NOSAMPLESPLAYED, GetState returns only the buffer state, not the sampler state. GetState takes roughly one-third as much time to complete when you specify XAUDIO2_VOICE_NOSAMPLESPLAYED.

Return value

This method does not return a value.


If a client needs to get the correlated positions of several voices (for example, to know exactly which sample of a given voice is playing when a given sample of another voice is playing), it must make GetState calls in an XAudio2 engine callback. This ensures that none of the voices advance while the calls are being made. See the XAudio2 Callbacks overview for information about using XAudio2 callbacks.

Note that the DirectX SDK versions of XAUDIO2 do not take the Flags parameter for GetState.

Platform Requirements

Windows 10 (XAudio2.9); Windows 8, Windows Phone 8 (XAudio 2.8); DirectX SDK (XAudio 2.7)




See also

How to: Stream a Sound from Disk



© 2017 Microsoft