Windows apps
Collapse the table of content
Expand the table of content
Information
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.

IXAudio2VoiceCallback::OnBufferStart method

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

Syntax


virtual void OnBufferStart(
   void *pBufferContext
) = 0;

Parameters

pBufferContext

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

Return value

This method does not return a value.

Remarks

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

OnBufferStart is guaranteed to be called just before the first byte of the current buffer is consumed. It is appropriate to use this callback for changes to the voice state such as the following.

  • Submitting a new buffer to the voice
  • Adjusting the volume, pitch, and effect parameters of the voice
  • Enabling or disabling an effect in the voice's effect chain
All the actions listed above are synchronous when performed in an XAudio2 callback, so the changes will take effect immediately, affecting the buffer that is about to start.

It is also safe to use this callback to write audio data to the buffer directly, which can be useful for low-latency streaming scenarios. However, as with all XAudio2 callbacks, no work should be done that uses a significant amount of processor time or could block execution, including synchronous disk or network reads.

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

Platform Requirements

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

Requirements

Header

Xaudio2.h

See also

IXAudio2VoiceCallback
XAudio2 Callbacks
How to: Use Source Voice Callbacks

 

 

Show:
© 2017 Microsoft