XAudio2 Migration Guide
You can easily update existing XAudio code to use XAudio2 by consulting the sections below, and making the changes listed in each section.
Headers
XAudio Header | XAudio2 Header |
---|---|
XAudio.h | XAudio2.h |
Libraries
XAudio Library | XAudio2 Library |
---|---|
XAudio.lib | XAudio2.lib, in addition XAudio2.lib has a dependency on xmcore.lib. |
XAudiod.lib | XAudiod2.lib, in addition XAudiod2.lib has a dependency on xmcored.lib. |
Interfaces
XAudio Interface | XAudio2 Interface |
---|---|
IXAudioVoice | IXAudio2Voice |
IXAudioSourceVoice | IXAudio2SourceVoice |
IXAudioSubmixVoice | IXAudio2SubmixVoice |
IXAudioMasteringVoice | IXAudio2MasteringVoice |
Methods
XAudio Method | XAudio2 Method |
---|---|
IXAudioVoice::AddRef | No equivalent. |
IXAudioVoice::Release | No equivalent. |
IXAudioVoice::GetEffectState | IXAudio2Voice::GetEffectState. |
IXAudioVoice::SetEffectState | IXAudio2Voice::DisableEffect or IXAudio2Voice::EnableEffect. |
IXAudioVoice::GetEffectParam | IXAudio2Voice::GetEffectParameters. |
IXAudioVoice::SetEffectParam | IXAudio2Voice::SetEffectParameters. |
IXAudioVoice::SetVoiceOutput | IXAudio2Voice::SetOutputVoices. |
IXAudioVoice::SetVoiceOutputVolume | IXAudio2Voice::SetChannelVolumes (channel levels affecting all sends), or IXAudio2Voice::SetOutputMatrix (per-send level matrix). |
IXAudioVoice::GetVoiceContext | The client is expected to cache the voice context it passed in. |
IXAudioVoice::GetVoiceState | IXAudio2SourceVoice::GetState. |
IXAudioVoice::GetVoiceType | The client is expected to cache the voice type created. |
IXAudioVoice::GetVoiceFormat | The client is expected to cache the format used to create the voice. |
IXAudioSourceVoice::SetVoiceFormat | The format cannot be changed after a voice is created. |
IXAudioSourceVoice::SubmitPacket | IXAudio2SourceVoice::SubmitSourceBuffer. |
IXAudioSourceVoice::SubmitSourceBuffer | IXAudio2SourceVoice::SubmitSourceBuffer. |
IXAudioSourceVoice::Start | IXAudio2SourceVoice::Start. |
IXAudioSourceVoice::Stop | IXAudio2SourceVoice::Stop. |
IXAudioSourceVoice::FlushPackets | IXAudio2SourceVoice::Stop with the XAUDIO2_FLUSH_BUFFERS flag. |
IXAudioSourceVoice::FlushSourceBuffers | IXAudio2SourceVoice::Stop with the XAUDIO2_FLUSH_BUFFERS flag. |
IXAudioSourceVoice::Discontinuity | Tag the last buffer in an audio stream with the XAUDIO2_END_OF_STREAM flag. |
IXAudioSourceVoice::GetPacketPosition | IXAudio2SourceVoice::GetState. |
IXAudioSourceVoice::SetPacketPosition | Not supported. Submit a new packet pointing at the position you want to play from instead. |
IXAudioSourceVoice::GetStreamPosition | IXAudio2SourceVoice::GetState. |
IXAudioSourceVoice::GetPacketLoopCount | No equivalent. |
IXAudioSourceVoice::SetPacketLoopCount | Loop count can only be set when submitting a packet. |
IXAudioSourceVoice::GetPacketContext | The client is expected to cache the packet context it used. |
IXAudioSourceVoice::GetVolume | IXAudio2Voice::GetVolume. |
IXAudioSourceVoice::SetVolume | IXAudio2Voice::SetVolume. |
IXAudioSourceVoice::GetPitch | IXAudio2SourceVoice::SetFrequencyRatio. |
IXAudioSourceVoice::SetPitch | IXAudio2SourceVoice::GetFrequencyRatio. |
IXAudioSourceVoice::GetFrequencyScale | A change in the units used to represent pitch has made this method unnecessary. |
IXAudioSourceVoice::SetFrequencyScale | A change in the units used to represent pitch has made this method unnecessary. |
Functions
XAudio Function | XAudio2 Function |
---|---|
XAudioInitialize | XAudio2Create. |
XAudioShutdown | IXAudio2::Release. |
XAudioLock | No equivalent. |
XAudioCreateSourceVoice | IXAudio2::CreateSourceVoice. |
XAudioCreateSubmixVoice | IXAudio2::CreateSubmixVoice. |
XAudioGetMasteringVoice | IXAudio2::CreateMasteringVoice. |
XAudioRegisterEngineCallback | XAudio2 does not support changing callback pointers on the fly. Callbacks are specified at voice creation with the pCallback argument. |
XAudioUnregisterEngineCallback | XAudio2 does not support changing callback pointers on the fly. Callbacks are specified at voice creation with the pCallback argument. |
XAudioRegisterEffects | XAudio2 does not require a static table of usable effects. The client creates any effects it wants to use and hands XAudio2 pointers to them. |
XAudioUnregisterEffects | XAudio2 does not require a static table of usable effects. The client creates any effects it wants to use and hands XAudio2 pointers to them. |
XAudioSynchStart | XAudio2 methods with an OperationSet argument can be grouped by specifying the same set number, and then calling IXAudio2::CommitChanges. See XAudio2 Operation Sets for more information. |
XAudioQueryPerformance | IXAudio2::GetPerformanceData. |
XAudioQueryPIXCounters | IXAudio2::GetPerformanceData. |
XAudioGetSpeakerConfig | IXAudio2::GetDeviceDetails is the nearest equivalent. On Windows, there may be more than one audio device, and the devices' output formats may differ in more than just their speaker configuration. This means the function returns full per-device output format data. |
XAudioDecibelsToVolume | XAudio2DecibelsToAmplitudeRatio. |
XAudioMillibelsToVolume | XAudio2DecibelsToAmplitudeRatio. |
XAudioVolumeToDecibels | XAudio2AmplitudeRatioToDecibels. |
XAudioVolumeToMillibels | XAudio2AmplitudeRatioToDecibels. |
XAudioPitchToSampleRate | XAudio2SemitonesToFrequencyRatio. |
XAudioSampleRateToPitch | XAudio2FrequencyRatioToSemitones. |
XAudioDumpMemoryUsage | No equivalent. The XMem library provides top-level statistics on XAudio2’s memory usage. |
XAudioGetXMAPacketPosition | GetXmaDecodePositionForSample in xma2defs.h. |
XAudioSetDebugBreakLevel | Controlled using the registry on Windows, or using an xaudio2.ini file in the executable's directory on either Windows or Xbox. |
XAudioSetDebugFlags | Controlled using the registry on Windows, or using an xaudio2.ini file in the executable's directory on either Windows or Xbox. |
XAudioSetDebugPrintLevel | Controlled using the registry on Windows, or using an xaudio2.ini file in the executable's directory on either Windows or Xbox. |
XAudioCreateEvent | No equivalent. |
XAudioFreeEvent | No equivalent. |
XAudioSetEvent | No equivalent. |
XAudioResetEvent | No equivalent. |
XAudioPulseEvent | No equivalent. |
XAudioWaitForSingleObject | No equivalent. |
XAudioWaitForMultipleObjects | No equivalent. |
Structures
XAudio Structure | XAudio2 Structure |
---|---|
PCMWAVEFORMAT | WAVEFORMATEX |
WAVEFORMAT | WAVEFORMATEX |
APIs Impacted by the Deprecation of XAudio
The following APIs are impacted by the deprecation of XAudio, and require some changes to migrate to XAudio2.
API | Migration Guide |
---|---|
XACT | XACT3 Migration Guide |
Xbox 360 |
---|
API Migration Guide
XMV XMV2 Migration Guide
XHV XHV Migration Guide
QNET QNet with XAudio2 Migration Guide
|
Related Topics
- XAudio2 Reference
Provides links to topics in the XAudio2 Reference section.