mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
Audio : allow XAudio2 to run its own thread (#1980)
This commit is contained in:
parent
132093c80e
commit
53b2e19d96
@ -62,6 +62,7 @@ void XAudio2Thread::xa27_destroy()
|
|||||||
{
|
{
|
||||||
s_tls_xaudio2_instance->StopEngine();
|
s_tls_xaudio2_instance->StopEngine();
|
||||||
s_tls_xaudio2_instance->Release();
|
s_tls_xaudio2_instance->Release();
|
||||||
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
@ -117,6 +118,8 @@ void XAudio2Thread::xa27_open()
|
|||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
LOG_ERROR(GENERAL, "XAudio2Thread : CreateSourceVoice() failed(0x%08x)", (u32)hr);
|
LOG_ERROR(GENERAL, "XAudio2Thread : CreateSourceVoice() failed(0x%08x)", (u32)hr);
|
||||||
|
s_tls_xaudio2_instance->Release();
|
||||||
|
CoUninitialize();
|
||||||
Emu.Pause();
|
Emu.Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,14 @@ void XAudio2Thread::xa28_init(void* module)
|
|||||||
|
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
|
hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED); // allow Xaudio2 run in its own thread
|
||||||
|
if (FAILED(hr))
|
||||||
|
{
|
||||||
|
LOG_ERROR(GENERAL, "XAudio2Thread : CoInitializeEx() failed(0x%08x)", (u32)hr);
|
||||||
|
Emu.Pause();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
hr = create(&s_tls_xaudio2_instance, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
hr = create(&s_tls_xaudio2_instance, 0, XAUDIO2_DEFAULT_PROCESSOR);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
@ -56,6 +64,7 @@ void XAudio2Thread::xa28_destroy()
|
|||||||
{
|
{
|
||||||
s_tls_xaudio2_instance->StopEngine();
|
s_tls_xaudio2_instance->StopEngine();
|
||||||
s_tls_xaudio2_instance->Release();
|
s_tls_xaudio2_instance->Release();
|
||||||
|
CoUninitialize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +118,8 @@ void XAudio2Thread::xa28_open()
|
|||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
LOG_ERROR(GENERAL, "XAudio2Thread : CreateSourceVoice() failed(0x%08x)", (u32)hr);
|
LOG_ERROR(GENERAL, "XAudio2Thread : CreateSourceVoice() failed(0x%08x)", (u32)hr);
|
||||||
|
s_tls_xaudio2_instance->Release();
|
||||||
|
CoUninitialize();
|
||||||
Emu.Pause();
|
Emu.Pause();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user