Reconfigures the voice to consume source data at a different sample rate than the rate specified when the voice was created. Microsoft Docs: The new sample rate the voice should process submitted data at. Valid sample rates are 1kHz to 200kHz. Releases a reference to the XAudio2 object. Microsoft Docs: Stops looping the voice when it reaches the end of the current loop region. Microsoft Docs: Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Returns current resource usage details, such as available memory or CPU usage. Microsoft Docs: On success, pointer to an XAUDIO2_PERFORMANCE_DATA structure that is returned. Returns information about the creation flags, input channels, and sample rate of a voice. Microsoft Docs: XAUDIO2_VOICE_DETAILS structure containing information about the voice. Creates and configures a mastering voice. Microsoft Docs: If successful, returns a pointer to the new IXAudio2MasteringVoice object. TBD Flags that specify the behavior of the mastering voice. Must be 0. Number of channels the mastering voice expects in its input audio. InputChannels must be less than or equal to XAUDIO2_MAX_AUDIO_CHANNELS. You can set InputChannels to XAUDIO2_DEFAULT_CHANNELS, which causes XAudio2 to try to detect the system speaker configuration setup. Sample rate of the input audio data of the mastering voice. This rate must be a multiple of XAUDIO2_QUANTUM_DENOMINATOR. InputSampleRate must be between XAUDIO2_MIN_SAMPLE_RATE and XAUDIO2_MAX_SAMPLE_RATE. You can set InputSampleRate to XAUDIO2_DEFAULT_SAMPLERATE, with the default being determined by the current platform. Windows XP defaults to 44100. Windows Vista and Windows 7 default to the setting specified in the Sound Control Panel. The default for this setting is 44100 (or 48000 if required by the driver). Flags The audio stream category to use for this mastering voice. Pointer to an XAUDIO2_EFFECT_CHAIN structure that describes an effect chain to use in the mastering voice, or NULL to use no effects. Identifier of the device to receive the output audio. Specifying the default value of NULL causes XAudio2 to select the global default audio device. Inline function that converts from the radian frequencies used in XAUDIO2_FILTER_PARAMETERS back to absolute frequencies in hertz. Microsoft Docs: Value of the Frequency member of the XAUDIO2_FILTER_PARAMETERS structure. The sample rate of the audio data affected by the XAUDIO2_FILTER_PARAMETERS structure. Enables the effect at a given position in the effect chain of the voice. Microsoft Docs: Zero-based index of an effect in the effect chain of the voice. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Called by XAudio2 just before an audio processing pass begins. Microsoft Docs: Called if a critical system error occurs that requires XAudio2 to be closed down and restarted. Microsoft Docs: Error code returned by XAudio2. Sets parameters for a given effect in the voice's effect chain. Microsoft Docs: Zero-based index of an effect within the voice's effect chain. Returns the current values of the effect-specific parameters. Size of the pParameters array in bytes. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Removes all pending audio buffers from the voice queue. Microsoft Docs: Notifies an XAudio2 voice that no more buffers are coming after the last one that is currently in its queue. Microsoft Docs: Inline function that converts from filter cutoff frequencies expressed in hertz to the radian frequency values used in the Frequency member of the XAUDIO2_FILTER_PARAMETERS structure. Microsoft Docs: The cutoff frequency in hertz. Frequencies greater than SampleRate ÷ 6 are clamped to XAUDIO2_MAX_FILTER_FREQUENCY. The sample rate of the audio data affected by the XAUDIO2_FILTER_PARAMETERS structure. Gets the volume level of each channel of the final output for the voice. These channels are mapped to the input channels of a specified destination voice. Microsoft Docs: Pointer specifying the destination IXAudio2Voice to retrieve the output matrix for.
Note  If the voice sends to a single target voice then specifying NULL will cause GetOutputMatrix to operate on that target voice.
 
Confirms the output channel count of the voice. This is the number of channels that are produced by the last effect in the chain. Confirms the input channel count of the destination voice. Array of [SourceChannels * DestinationChannels] volume levels sent to the destination voice. The level sent from source channel S to destination channel D is returned in the form pLevelMatrix[DestinationChannels × S + D]. See Remarks for more information on volume levels.
Called during each processing pass for each voice, just before XAudio2 reads data from the voice's buffer queue. Microsoft Docs: The number of bytes that must be submitted immediately to avoid starvation. This allows the implementation of just-in-time streaming scenarios; the client can keep the absolute minimum data queued on the voice at all times, and pass it fresh data just before the data is required. This model provides the lowest possible latency attainable with XAudio2. For xWMA and XMA data BytesRequired will always be zero, since the concept of a frame of xWMA or XMA data is meaningless.
Note  In a situation where there is always plenty of data available on the source voice, BytesRequired should always report zero, because it doesn't need any samples immediately to avoid glitching.
 
Gets the voice's filter parameters. Microsoft Docs: Pointer to an XAUDIO2_FILTER_PARAMETERS structure containing the filter information. Creates a new volume meter audio processing object (APO) and returns a pointer to it. Microsoft Docs: Contains the created volume meter APO. Called when the voice is about to start processing a new audio buffer. Microsoft Docs: Context pointer that was assigned to the pContext member of the XAUDIO2_BUFFER structure when the buffer was submitted. Removes an IXAudio2EngineCallback pointer from the XAudio2 engine callback list. Microsoft Docs: IXAudio2EngineCallback pointer to remove from the XAudio2 engine callback list. If the given pointer is present more than once in the list, only the first instance in the list will be removed. Sets the volume level of each channel of the final output for the voice. These channels are mapped to the input channels of a specified destination voice. Microsoft Docs: Pointer to a destination IXAudio2Voice for which to set volume levels.
Note  If the voice sends to a single target voice then specifying NULL will cause SetOutputMatrix to operate on that target voice.
 
Confirms the output channel count of the voice. This is the number of channels that are produced by the last effect in the chain. Confirms the input channel count of the destination voice. Array of [SourceChannels × DestinationChannels] volume levels sent to the destination voice. The level sent from source channel S to destination channel D is specified in the form pLevelMatrix[SourceChannels × D + S]. For example, when rendering two-channel stereo input into 5.1 output that is weighted toward the front channels—but is absent from the center and low-frequency channels—the matrix might have the values shown in the following table.
Output Left Input [Array Index] Right Input [Array Index]
Left 1.0 [0] 0.0 [1]
Right 0.0 [2] 1.0 [3]
Front Center 0.0 [4] 0.0 [5]
LFE 0.0 [6] 0.0 [7]
Rear Left 0.8 [8] 0.0 [9]
Rear Right 0.0 [10] 0.8 [11]
 
Note  The left and right input are fully mapped to the output left and right channels; 80 percent of the left and right input is mapped to the rear left and right channels.
 
See Remarks for more information on volume levels. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information.
Adds a new audio buffer to the voice queue. Microsoft Docs: Pointer to an XAUDIO2_BUFFER structure to queue. TBD Pointer to an additional XAUDIO2_BUFFER_WMA structure used when submitting WMA data. Adds a reference to the XAudio2 object. Microsoft Docs: Called when the voice has just finished playing a contiguous audio stream. Microsoft Docs: Called when the voice reaches the end position of a loop. Microsoft Docs: Context pointer that was assigned to the pContext member of the XAUDIO2_BUFFER structure when the buffer was submitted. Sets the overall volume level for the voice. Microsoft Docs: Overall volume level to use. See Remarks for more information on volume levels. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Queries for a given COM interface on the XAudio2 object. Microsoft Docs: The REFIID that identifies the interface to query for. Address of a pointer that receives the interface. Returns the volume levels for the voice, per channel. Microsoft Docs: Confirms the channel count of the voice. Returns the current volume level of each channel in the voice. The array must have at least Channels elements. See Remarks for more information on volume levels. Gets the current overall volume level of the voice. Microsoft Docs: Returns the current overall volume level of the voice. See Remarks for more information on volume levels. Destroys the voice. If necessary, stops the voice and removes it from the XAudio2 graph. Microsoft Docs: Called when a critical error occurs during voice processing. Microsoft Docs: Context pointer that was assigned to the pContext member of the XAUDIO2_BUFFER structure when the buffer was submitted. The HRESULT code of the error encountered. Returns the running state of the effect at a specified position in the effect chain of the voice. Microsoft Docs: Zero-based index of an effect in the effect chain of the voice. Returns TRUE If the effect is enabled. If the effect is disabled, returns FALSE. Sets the voice's filter parameters. Microsoft Docs: Pointer to an XAUDIO2_FILTER_PARAMETERS structure containing the filter information. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Returns the current effect-specific parameters of a given effect in the voice's effect chain. Microsoft Docs: Zero-based index of an effect within the voice's effect chain. Returns the current values of the effect-specific parameters. Size, in bytes, of the pParameters array. Returns the voice's current cursor position data. Microsoft Docs: Pointer to an XAUDIO2_VOICE_STATE structure containing the state of the voice. TBD Flags controlling which voice state data should be returned. Valid values are 0 or XAUDIO2_VOICE_NOSAMPLESPLAYED. The default value is 0. If you specify XAUDIO2_VOICE_NOSAMPLESPLAYED, GetState returns only the buffer state, not the sampler state. GetState takes roughly one-third as much time to complete when you specify XAUDIO2_VOICE_NOSAMPLESPLAYED. Returns the filter parameters from one of this voice's sends. Microsoft Docs: IXAudio2Voice pointer to the destination voice of the send whose filter parameters will be read. Pointer to an XAUDIO2_FILTER_PARAMETERS structure containing the filter information. Creates a new reverb audio processing object (APO), and returns a pointer to it. Microsoft Docs: Contains a pointer to the reverb APO that is created. Inline function that converts a frequency ratio value to a semitone value. Microsoft Docs: Floating point value representing the frequency ratio. Adds an IXAudio2EngineCallback pointer to the XAudio2 engine callback list. Microsoft Docs: IXAudio2EngineCallback pointer to add to the XAudio2 engine callback list. Returns the channel mask for this voice. Microsoft Docs: Returns the channel mask for this voice. This corresponds to the dwChannelMask member of the WAVEFORMATEXTENSIBLE structure. Creates a new XAudio2 object and returns a pointer to its IXAudio2 interface. Microsoft Docs: If the operation is successful, returns a pointer to an IXAudio2 object. Flags that specify the behavior of the IXAudio2 object. The value of this parameter must be 0. An XAUDIO2_PROCESSOR-typed value that specifies which CPU to use. If multiple bits are specified, the system will create a separate worker thread for each processor. XAUDIO2_PROCESSOR default value is XAUDIO2_DEFAULT_PROCESSOR. Warning If you specify XAUDIO2_ANY_PROCESSOR, the system will use all of the device's processors and, as noted above, create a worker thread for each processor. Note  Specifying a processor should generally be avoided because it can interfere with the scheduler's ability to schedule threads effectively across processors. Instead, pass the XAUDIO2_DEFAULT_PROCESSOR value (see below). The special XAUDIO2_DEFAULT_PROCESSOR value causes XAudio2 to use its default processor. Changes global debug logging options for XAudio2. Microsoft Docs: Pointer to a XAUDIO2_DEBUG_CONFIGURATION structure that contains the new debug configuration. This parameter is reserved and must be NULL. Creates and configures a source voice. Microsoft Docs: If successful, returns a pointer to the new IXAudio2SourceVoice object. Pointer to a one of the structures in the table below. This structure contains the expected format for all audio buffers submitted to the source voice. XAudio2 supports PCM and ADPCM voice types.
Format tag Wave format structure Size (in bytes)
WAVE_FORMAT_PCM (0x0001) PCMWAVEFORMAT 16
-or- WAVEFORMATEX 18
WAVE_FORMAT_IEEE_FLOAT (0x0003) [32-bit] PCMWAVEFORMAT 18
WAVE_FORMAT_ADPCM (0x0002) [MS-ADPCM] ADPCMWAVEFORMAT 50
WAVE_FORMAT_EXTENSIBLE (0xFFFE) WAVEFORMATEXTENSIBLE 40
  XAudio2 supports the following PCM formats.
  • 8-bit (unsigned) integer PCM
  • 16-bit integer PCM (optimal format for XAudio2)
  • 20-bit integer PCM (either in 24 or 32 bit containers)
  • 24-bit integer PCM (either in 24 or 32 bit containers)
  • 32-bit integer PCM
  • 32-bit float PCM (preferred format after 16-bit integer)
The number of channels in a source voice must be less than or equal to XAUDIO2_MAX_AUDIO_CHANNELS. The sample rate of a source voice must be between XAUDIO2_MIN_SAMPLE_RATE and XAUDIO2_MAX_SAMPLE_RATE.
Note  PCM data formats such as PCMWAVEFORMAT and ADPCMWAVEFORMAT that require more information than provided by WAVEFORMATEX have a WAVEFORMATEX structure as the first member in their format structures. When you create a source voice with one of those formats, cast the format's structure as a WAVEFORMATEX structure and use it as the value for pSourceFormat.
 
TBD Flags that specify the behavior of the source voice. A flag can be 0 or a combination of one or more of the following:
Value Description
XAUDIO2_VOICE_NOPITCH No pitch control is available on the voice. 
XAUDIO2_VOICE_NOSRC No sample rate conversion is available on the voice. The voice's outputs must have the same sample rate.
Note  The XAUDIO2_VOICE_NOSRC flag causes the voice to behave as though the XAUDIO2_VOICE_NOPITCH flag also is specified.
 
XAUDIO2_VOICE_USEFILTER The filter effect should be available on this voice. 
 
Note  The XAUDIO2_VOICE_MUSIC flag is not supported on Windows.
 
Highest allowable frequency ratio that can be set on this voice. The value for this argument must be between XAUDIO2_MIN_FREQ_RATIO and XAUDIO2_MAX_FREQ_RATIO. Subsequent calls to IXAudio2SourceVoice::SetFrequencyRatio are clamped between XAUDIO2_MIN_FREQ_RATIO and MaxFrequencyRatio. The maximum value for this argument is defined as XAUDIO2_MAX_FREQ_RATIO, which allows pitch to be raised by up to 10 octaves. If MaxFrequencyRatio is less than 1.0, the voice will use that ratio immediately after being created (rather than the default of 1.0).
Xbox 360
For XMA voices, there is one more restriction on the MaxFrequencyRatio argument and the voice's sample rate. The product of these two numbers cannot exceed XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MONO for one-channel voices or XAUDIO2_MAX_RATIO_TIMES_RATE_XMA_MULTICHANNEL for voices with any other number of channels. If the value specified for MaxFrequencyRatio is too high for the specified format, the call to CreateSourceVoice fails and produces a debug message.
 
Note  You can use the lowest possible MaxFrequencyRatio value to reduce XAudio2's memory usage.
 
Pointer to a client-provided callback interface, IXAudio2VoiceCallback. Pointer to a list of XAUDIO2_EFFECT_CHAIN structures that describe an effect chain to use in the source voice. Pointer to a list of XAUDIO2_VOICE_SENDS structures that describe the set of destination voices for the source voice. If pSendList is NULL, the send list defaults to a single output to the first mastering voice created.
Inline function that converts a decibel value to an amplitude ratio value. Microsoft Docs: Floating point value representing the decibel level. Creates and configures a submix voice. Microsoft Docs: On success, returns a pointer to the new IXAudio2SubmixVoice object. Number of channels in the input audio data of the submix voice. InputChannels must be less than or equal to XAUDIO2_MAX_AUDIO_CHANNELS. Sample rate of the input audio data of submix voice. This rate must be a multiple of XAUDIO2_QUANTUM_DENOMINATOR. InputSampleRate must be between XAUDIO2_MIN_SAMPLE_RATE and XAUDIO2_MAX_SAMPLE_RATE. TBD Flags that specify the behavior of the submix voice. It can be 0 or the following:
Value Description
XAUDIO2_VOICE_USEFILTER The filter effect should be available on this voice.
An arbitrary number that specifies when this voice is processed with respect to other submix voices, if the XAudio2 engine is running other submix voices. The voice is processed after all other voices that include a smaller ProcessingStage value and before all other voices that include a larger ProcessingStage value. Voices that include the same ProcessingStage value are processed in any order. A submix voice cannot send to another submix voice with a lower or equal ProcessingStage value. This prevents audio being lost due to a submix cycle. Pointer to a list of XAUDIO2_EFFECT_CHAIN structures that describe an effect chain to use in the submix voice. Pointer to a list of XAUDIO2_VOICE_SENDS structures that describe the set of destination voices for the submix voice. If pSendList is NULL, the send list will default to a single output to the first mastering voice created.
Stops consumption of audio by the current voice. Microsoft Docs: TBD Flags that control how the voice is stopped. Can be 0 or the following:
Value Description
XAUDIO2_PLAY_TAILS Continue emitting effect output after the voice is stopped. 
Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information.
The IXAudio2VoiceCallback interface contains methods that notify the client when certain events happen in a given IXAudio2SourceVoice. Microsoft Docs: Inline function that converts a semitone value to a frequency ratio value. Microsoft Docs: Floating point value representing the semitone value. Designates a new set of submix or mastering voices to receive the output of the voice. Microsoft Docs: Array of XAUDIO2_VOICE_SENDS structure pointers to destination voices. If pSendList is NULL, the voice will send its output to the current mastering voice. To set the voice to not send its output anywhere set the OutputCount member of XAUDIO2_VOICE_SENDS to 0. All of the voices in a send list must have the same input sample rate, see XAudio2 Sample Rate Conversions for additional information. Called just after the processing pass for the voice ends. Microsoft Docs: Sets the frequency adjustment ratio of the voice. Microsoft Docs: Frequency adjustment ratio. This value must be between XAUDIO2_MIN_FREQ_RATIO and the MaxFrequencyRatio parameter specified when the voice was created (see IXAudio2::CreateSourceVoice). XAUDIO2_MIN_FREQ_RATIO currently is 0.0005, which allows pitch to be lowered by up to 11 octaves. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Called by XAudio2 just after an audio processing pass ends. Microsoft Docs: Stops the audio processing thread. Microsoft Docs: The IXAudio2EngineCallback interface contains methods that notify the client when certain events happen in the IXAudio2 engine. Microsoft Docs: Atomically applies a set of operations that are tagged with a given identifier. Microsoft Docs: Identifier of the set of operations to be applied. To commit all pending operations, pass XAUDIO2_COMMIT_ALL. Inline function that converts an amplitude ratio value to a decibel value. Microsoft Docs: Floating point value representing the amplitude ratio. Returns the frequency adjustment ratio of the voice. Microsoft Docs: Returns the current frequency adjustment ratio if successful. Sets the filter parameters on one of this voice's sends. Microsoft Docs: IXAudio2Voice pointer to the destination voice of the send whose filter parameters will be set. Pointer to an XAUDIO2_FILTER_PARAMETERS structure containing the filter information. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Replaces the effect chain of the voice. Microsoft Docs: Pointer to an XAUDIO2_EFFECT_CHAIN structure that describes the new effect chain to use. If NULL is passed, the current effect chain is removed.
Note  If pEffectChain is non-NULL, the XAUDIO2_EFFECT_CHAIN structure that it points to must specify at least one effect.
 
Disables the effect at a given position in the effect chain of the voice. Microsoft Docs: Zero-based index of an effect in the effect chain of the voice. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. A submix voice is used primarily for performance improvements and effects processing. Microsoft Docs: A mastering voice is used to represent the audio output device. Microsoft Docs: Inline function that converts from filter cutoff frequencies expressed in hertz to the filter coefficients used with the Frequency member of the XAUDIO2_FILTER_PARAMETERS structure. Microsoft Docs: The cutoff frequency in hertz. Frequencies greater than SampleRate are clamped to XAUDIO2_MAX_FILTER_FREQUENCY. The sample rate of the audio data affected by the XAUDIO2_FILTER_PARAMETERS structure. Starts consumption and processing of audio by the voice. Delivers the result to any connected submix or mastering voices, or to the output device. Microsoft Docs: TBD Flags that control how the voice is started. Must be 0. Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information. Starts the audio processing thread. Microsoft Docs: Use a source voice to submit audio data to the XAudio2 processing pipeline. Microsoft Docs: Called when the voice finishes processing a buffer. Microsoft Docs: Context pointer assigned to the pContext member of the XAUDIO2_BUFFER structure when the buffer was submitted. Sets the volume levels for the voice, per channel. Microsoft Docs: Number of channels in the voice. Array containing the new volumes of each channel in the voice. The array must have Channels elements. See Remarks for more information on volume levels. TBD Identifies this call as part of a deferred batch. See the XAudio2 Operation Sets overview for more information.