IXAudio2VoiceCallback interface (xaudio2.h)

The IXAudio2VoiceCallback interface contains methods that notify the client when certain events happen in a given IXAudio2SourceVoice.

This interface should be implemented by the XAudio2 client. XAudio2 calls these methods through an interface pointer provided by the client in the IXAudio2::CreateSourceVoice method. Methods in this interface return void, rather than an HRESULT.

See the XAudio2 Callbacks topic for restrictions on callback implementation.

Method Description
OnBufferEnd Called when the voice finishes processing a buffer.
OnBufferStart Called when the voice is about to start processing a new audio buffer.
OnLoopEnd Called when the voice reaches the end position of a loop.
OnStreamEnd Called when the voice has just finished playing a contiguous audio stream.
OnVoiceError Called when a critical error occurs during voice processing.
OnVoiceProcessingPassEnd Called just after the processing pass for the voice ends.
OnVoiceProcessingPassStart Called during each processing pass for each voice, just before XAudio2 reads data from the voice's buffer queue.

Methods

The IXAudio2VoiceCallback interface has these methods.

 
IXAudio2VoiceCallback::OnBufferEnd

Called when the voice finishes processing a buffer.
IXAudio2VoiceCallback::OnBufferStart

Called when the voice is about to start processing a new audio buffer.
IXAudio2VoiceCallback::OnLoopEnd

Called when the voice reaches the end position of a loop.
IXAudio2VoiceCallback::OnStreamEnd

Called when the voice has just finished playing a contiguous audio stream.
IXAudio2VoiceCallback::OnVoiceError

Called when a critical error occurs during voice processing.
IXAudio2VoiceCallback::OnVoiceProcessingPassEnd

Called just after the processing pass for the voice ends.
IXAudio2VoiceCallback::OnVoiceProcessingPassStart

Called during each processing pass for each voice, just before XAudio2 reads data from the voice's buffer queue.

Remarks

Platform Requirements

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

Requirements

Requirement Value
Target Platform Windows
Header xaudio2.h

See also

How to: Stream a Sound from Disk

How to: Use Source Voice Callbacks

XAudio2 Callbacks

XAudio2 Interfaces