Merge pull request #11830 from IAmBoring/boring1
XAudio2 threaded creation
This commit is contained in:
commit
bd405eb7c3
|
@ -180,6 +180,10 @@ static void xaudio2_free(xaudio2_t *handle)
|
||||||
#else
|
#else
|
||||||
free(handle);
|
free(handle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if !defined(_XBOX) && !defined(__WINRT__)
|
||||||
|
CoUninitialize();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||||
|
@ -188,14 +192,26 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
||||||
int32_t idx_found = -1;
|
int32_t idx_found = -1;
|
||||||
WAVEFORMATEX wfx = {0};
|
WAVEFORMATEX wfx = {0};
|
||||||
struct string_list *list = NULL;
|
struct string_list *list = NULL;
|
||||||
|
xaudio2_t *handle = NULL;
|
||||||
|
|
||||||
|
#if !defined(_XBOX) && !defined(__WINRT__)
|
||||||
|
if (FAILED(CoInitialize(NULL)))
|
||||||
|
goto error;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(__cplusplus) && !defined(CINTERFACE)
|
#if defined(__cplusplus) && !defined(CINTERFACE)
|
||||||
xaudio2_t *handle = new xaudio2;
|
handle = new xaudio2;
|
||||||
#else
|
#else
|
||||||
xaudio2_t *handle = (xaudio2_t*)calloc(1, sizeof(*handle));
|
handle = (xaudio2_t*)calloc(1, sizeof(*handle));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!handle)
|
if (!handle)
|
||||||
|
{
|
||||||
|
#if !defined(_XBOX) && !defined(__WINRT__)
|
||||||
|
CoUninitialize();
|
||||||
|
#endif
|
||||||
goto error;
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
list = (struct string_list*)xa_list_new(NULL);
|
list = (struct string_list*)xa_list_new(NULL);
|
||||||
|
|
||||||
|
@ -297,6 +313,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency,
|
||||||
{
|
{
|
||||||
size_t bufsize;
|
size_t bufsize;
|
||||||
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
|
xa_t *xa = (xa_t*)calloc(1, sizeof(*xa));
|
||||||
|
|
||||||
if (!xa)
|
if (!xa)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -309,7 +326,7 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency,
|
||||||
xa->xa = xaudio2_new(rate, 2, xa->bufsize, device);
|
xa->xa = xaudio2_new(rate, 2, xa->bufsize, device);
|
||||||
if (!xa->xa)
|
if (!xa->xa)
|
||||||
{
|
{
|
||||||
RARCH_ERR("Failed to init XAudio2.\n");
|
RARCH_ERR("[XAudio2] Failed to init driver.\n");
|
||||||
free(xa);
|
free(xa);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue