Revert "Backport"

This reverts commit 685db05032.
This commit is contained in:
twinaphex 2020-05-11 03:49:16 +02:00
parent f5b33c8912
commit 4a9e1e6c7e

View File

@ -1,7 +1,6 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2020 - Daniel De Matteis
* Copyright (C) 2020 - neil4
* Copyright (C) 2011-2017 - Daniel De Matteis
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
@ -43,7 +42,6 @@
#include "../common/mmdevice_common.h"
#endif
#include "../../command.h"
#include "../../retroarch.h"
#include "../../verbosity.h"
@ -59,8 +57,6 @@ typedef struct xaudio2 xaudio2_t;
#define XAUDIO2_WRITE_AVAILABLE(handle) ((handle)->bufsize * (MAX_BUFFERS - (handle)->buffers - 1))
static unsigned xaudio2_device_count;
typedef struct
{
xaudio2_t *xa;
@ -284,8 +280,6 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
XAUDIO2_COMMIT_NOW)))
goto error;
IXAudio2_GetDeviceCount(handle->pXAudio2, &xaudio2_device_count);
if (list)
string_list_free(list);
return handle;
@ -330,21 +324,10 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency,
static ssize_t xa_write(void *data, const void *buf, size_t size)
{
unsigned bytes;
unsigned dev_count;
xa_t *xa = (xa_t*)data;
xaudio2_t *handle = xa->xa;
const uint8_t *buffer = (const uint8_t*)buf;
/* TODO/FIXME - register a callback instead */
IXAudio2_GetDeviceCount(handle->pXAudio2, &dev_count);
if (dev_count != xaudio2_device_count)
{
xaudio2_device_count = dev_count;
command_event(CMD_EVENT_AUDIO_REINIT, NULL);
return 0;
}
if (xa->nonblock)
{
size_t avail = XAUDIO2_WRITE_AVAILABLE(xa->xa);
@ -475,6 +458,7 @@ static void *xa_list_new(void *u)
#if defined(_XBOX) || !(_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
unsigned i;
union string_list_elem_attr attr;
uint32_t dev_count = 0;
IXAudio2 *ixa2 = NULL;
struct string_list *sl = string_list_new();
@ -486,9 +470,9 @@ static void *xa_list_new(void *u)
if (FAILED(XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
return NULL;
IXAudio2_GetDeviceCount(ixa2, &xaudio2_device_count);
IXAudio2_GetDeviceCount(ixa2, &dev_count);
for (i = 0; i < xaudio2_device_count; i++)
for (i = 0; i < dev_count; i++)
{
XAUDIO2_DEVICE_DETAILS dev_detail;
if (IXAudio2_GetDeviceDetails(ixa2, i, &dev_detail) == S_OK)