XAudio2Create failed after the update 2021/4/20

Hao Wu 21 Reputation points
2021-04-20T08:37:07.063+00:00

Windows10 version 20H2.

I followed every step-Getting started with XAudio2-How to: Initialize XAudio2.

The link is here. https://learn.microsoft.com/en-us/windows/win32/xaudio2/getting-started

The code worked before the update. But now when I try to do something like this:

pXAudio2->CreateSourceVoice( &pSourceVoice, (WAVEFORMATEX*)&wfx )
It is said the value of pSourceVoice is nullptr.

I'm sure I have done all these code down here.

Microsoft::WRL::ComPtr<IXAudio2> XAudio2;
HRESULT hr;
if ( FAILED(hr = XAudio2Create( &XAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR ) ) )
throw Platform::Exception::CreateException(hr);

IXAudio2MasteringVoice* pMasterVoice = nullptr;
if ( FAILED(hr = pXAudio2->CreateMasteringVoice( &pMasterVoice ) ) )
return hr;
Is there anything I can do now?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,772 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,962 questions
{count} votes

Accepted answer
  1. Fei Xue - MSFT 1,111 Reputation points
    2021-04-29T01:57:32.31+00:00

    @Hao Wu , The DirectX 9.0c SDK is very old. It is over 10+ years old so definitely the latest Direct X SDK is recommend to use. Please feel free to let us know if you still have issues if you are using the latest XAudio2 API.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.