XAUDIO2_POSITION

XAUDIO2_POSITION

Provides information about the buffer position and consumption of a source voice.

typedef struct XAUDIO2_POSITION {
    const BYTE *pCurrentBuffer;
    UINT64 SamplesPlayed;
} XAUDIO2_POSITION;

Members

  • pCurrentBuffer
    Pointer to the beginning of the source buffer currently being read, or the next buffer due to be read if the voice is stopped. This pointer is NULL if there are no buffers in the voice queue.
  • SamplesPlayed
    Total number of samples processed by this voice since it was last started or since the last audio stream ended, as marked with the XAUDIO2_END_OF_STREAM flag. This total includes samples played multiple times due to looping. Conceptually, if all audio emitted to date had been captured, this would be its length in samples.

Remarks

For all encoded formats including CBR formats like ADPCM, SamplesPlayed is given in terms of decoded samples. For PCM formats, SamplesPlayed is given in terms of either input or output samples, since they are equivalent in this case (there is a one-to-one mapping from input to output).

If a client needs to obtain the correlated positions of several voices (i.e. to know exactly which sample of a given a voice is playing when a given sample of another voice is playing), it must make the IXAudio2SourceVoice::GetPosition calls in an IXAudio2EngineCallback to ensure that none of the voices advance while the calls are being made.

Requirements

Header: Declared in Xaudio2.h.

See Also

XAudio2 Structures | IXAudio2SourceVoice::GetPosition