mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
(Xaudio) Cleanups
This commit is contained in:
parent
fbd4fc5094
commit
6c067d149d
1 changed files with 7 additions and 10 deletions
|
@ -304,10 +304,6 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency,
|
||||||
latency = 8; /* Do not allow shenanigans. */
|
latency = 8; /* Do not allow shenanigans. */
|
||||||
|
|
||||||
bufsize = latency * rate / 1000;
|
bufsize = latency * rate / 1000;
|
||||||
|
|
||||||
RARCH_LOG("[XAudio2]: Requesting %u ms latency, using %d ms latency.\n",
|
|
||||||
latency, (int)bufsize * 1000 / rate);
|
|
||||||
|
|
||||||
xa->bufsize = bufsize * 2 * sizeof(float);
|
xa->bufsize = bufsize * 2 * sizeof(float);
|
||||||
|
|
||||||
xa->xa = xaudio2_new(rate, 2, xa->bufsize, device);
|
xa->xa = xaudio2_new(rate, 2, xa->bufsize, device);
|
||||||
|
@ -318,12 +314,15 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency,
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RARCH_LOG("[XAudio2]: Requesting %u ms latency, using %d ms latency.\n",
|
||||||
|
latency, (int)bufsize * 1000 / rate);
|
||||||
|
|
||||||
return xa;
|
return xa;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = size;
|
||||||
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;
|
||||||
|
@ -335,11 +334,9 @@ static ssize_t xa_write(void *data, const void *buf, size_t size)
|
||||||
if (avail == 0)
|
if (avail == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (avail < size)
|
if (avail < size)
|
||||||
size = avail;
|
bytes = size = avail;
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes = size;
|
|
||||||
|
|
||||||
while (bytes)
|
while (bytes)
|
||||||
{
|
{
|
||||||
unsigned need = MIN(bytes, handle->bufsize - handle->bufptr);
|
unsigned need = MIN(bytes, handle->bufsize - handle->bufptr);
|
||||||
|
|
Loading…
Add table
Reference in a new issue