Called when the voice is about to start processing a new audio buffer.
public:
void OnBufferStart(
void *pBufferContext
)
pBufferContext
Type: void *
Context pointer that was assigned to the pContext member of the XAUDIO2_BUFFER structure when the buffer was submitted.
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.
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.
Header: Declared in xaudio2.h.
Library: Use xaudio2.lib.