mirror of
https://github.com/libretro/RetroArch
synced 2025-02-06 18:40:49 +00:00
Revert "Backport"
This reverts commit 685db0503205df8f0b9f04a3e786bb30dbbf707a.
This commit is contained in:
parent
f5b33c8912
commit
4a9e1e6c7e
@ -1,7 +1,6 @@
|
|||||||
/* RetroArch - A frontend for libretro.
|
/* RetroArch - A frontend for libretro.
|
||||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||||
* Copyright (C) 2011-2020 - Daniel De Matteis
|
* Copyright (C) 2011-2017 - Daniel De Matteis
|
||||||
* Copyright (C) 2020 - neil4
|
|
||||||
*
|
*
|
||||||
* RetroArch is free software: you can redistribute it and/or modify it under the terms
|
* 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-
|
* of the GNU General Public License as published by the Free Software Found-
|
||||||
@ -43,7 +42,6 @@
|
|||||||
#include "../common/mmdevice_common.h"
|
#include "../common/mmdevice_common.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../../command.h"
|
|
||||||
#include "../../retroarch.h"
|
#include "../../retroarch.h"
|
||||||
#include "../../verbosity.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))
|
#define XAUDIO2_WRITE_AVAILABLE(handle) ((handle)->bufsize * (MAX_BUFFERS - (handle)->buffers - 1))
|
||||||
|
|
||||||
static unsigned xaudio2_device_count;
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
xaudio2_t *xa;
|
xaudio2_t *xa;
|
||||||
@ -284,8 +280,6 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels,
|
|||||||
XAUDIO2_COMMIT_NOW)))
|
XAUDIO2_COMMIT_NOW)))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
IXAudio2_GetDeviceCount(handle->pXAudio2, &xaudio2_device_count);
|
|
||||||
|
|
||||||
if (list)
|
if (list)
|
||||||
string_list_free(list);
|
string_list_free(list);
|
||||||
return handle;
|
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)
|
static ssize_t xa_write(void *data, const void *buf, size_t size)
|
||||||
{
|
{
|
||||||
unsigned bytes;
|
unsigned bytes;
|
||||||
unsigned dev_count;
|
|
||||||
xa_t *xa = (xa_t*)data;
|
xa_t *xa = (xa_t*)data;
|
||||||
xaudio2_t *handle = xa->xa;
|
xaudio2_t *handle = xa->xa;
|
||||||
const uint8_t *buffer = (const uint8_t*)buf;
|
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)
|
if (xa->nonblock)
|
||||||
{
|
{
|
||||||
size_t avail = XAUDIO2_WRITE_AVAILABLE(xa->xa);
|
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*/)
|
#if defined(_XBOX) || !(_WIN32_WINNT >= 0x0602 /*_WIN32_WINNT_WIN8*/)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
union string_list_elem_attr attr;
|
union string_list_elem_attr attr;
|
||||||
|
uint32_t dev_count = 0;
|
||||||
IXAudio2 *ixa2 = NULL;
|
IXAudio2 *ixa2 = NULL;
|
||||||
struct string_list *sl = string_list_new();
|
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)))
|
if (FAILED(XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR)))
|
||||||
return NULL;
|
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;
|
XAUDIO2_DEVICE_DETAILS dev_detail;
|
||||||
if (IXAudio2_GetDeviceDetails(ixa2, i, &dev_detail) == S_OK)
|
if (IXAudio2_GetDeviceDetails(ixa2, i, &dev_detail) == S_OK)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user