mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-03-22 13:15:20 +01:00
XAudio2: Call CoInitializeEx to prevent errors
I could not properly reset the audio backend and call CreateMasteringVoice without getting errors
This commit is contained in:
parent
5b7ee43352
commit
8ee953ef8e
|
|
@ -19,6 +19,10 @@ XAudio2Backend::XAudio2Backend()
|
||||||
{
|
{
|
||||||
Microsoft::WRL::ComPtr<IXAudio2> instance;
|
Microsoft::WRL::ComPtr<IXAudio2> instance;
|
||||||
|
|
||||||
|
// In order to prevent errors on CreateMasteringVoice, apparently we need CoInitializeEx according to:
|
||||||
|
// https://docs.microsoft.com/en-us/windows/win32/api/xaudio2fx/nf-xaudio2fx-xaudio2createvolumemeter
|
||||||
|
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||||
|
|
||||||
HRESULT hr = XAudio2Create(instance.GetAddressOf(), 0, XAUDIO2_DEFAULT_PROCESSOR);
|
HRESULT hr = XAudio2Create(instance.GetAddressOf(), 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue