IXAudio2VoiceCallback::OnBufferEnd method (xaudio2.h)

Called when the voice finishes processing a buffer.


void OnBufferEnd(
  void *pBufferContext



Context pointer assigned to the pContext member of the XAUDIO2_BUFFER structure when the buffer was submitted.

Return value



After an OnBufferEnd callback the audio memory for the buffer associated with pBufferContext can safely be released.

pBufferContext is the context pointer originally provided by the pContext member of the XAUDIO2_BUFFER structure, which may be NULL.

OnBufferEnd is guaranteed to be called just after the last byte of the current buffer has been consumed and before the first byte of the next buffer is consumed. This callback can be used to overwrite or release the audio data referenced by the completed buffer, and to update other state associated with the voice as appropriate.

For information about IXAudio2VoiceCallback interface methods, see the XAudio2 Callbacks topic.

Platform Requirements

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


Requirement Value
Target Platform Windows
Header xaudio2.h

See also

How to: Stream a Sound from Disk

How to: Use Source Voice Callbacks