mirror of
https://github.com/libretro/RetroArch
synced 2025-03-24 13:43:32 +00:00
Might work better ...
This commit is contained in:
parent
6ad4b1f15a
commit
0e8f2339d8
@ -23,6 +23,7 @@
|
|||||||
#include <xenon_sound/sound.h>
|
#include <xenon_sound/sound.h>
|
||||||
|
|
||||||
#define SOUND_FREQUENCY 48000
|
#define SOUND_FREQUENCY 48000
|
||||||
|
#define MAX_BUFFER 2048
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -55,12 +56,12 @@ static ssize_t xenon360_write(void *data, const void *buf, size_t size)
|
|||||||
size_t written = 0;
|
size_t written = 0;
|
||||||
|
|
||||||
const uint32_t *in_buf = buf;
|
const uint32_t *in_buf = buf;
|
||||||
for (unsigned i = 0; i < (size >> 2); i++)
|
for (size_t i = 0; i < (size >> 2); i++)
|
||||||
xa->buffer[i] = bswap_32(in_buf[i]);
|
xa->buffer[i] = bswap_32(in_buf[i]);
|
||||||
|
|
||||||
if (!xa->nonblock)
|
if (!xa->nonblock)
|
||||||
{
|
{
|
||||||
while (xenon_sound_get_free() < size)
|
while (xenon_sound_get_unplayed() >= MAX_BUFFER)
|
||||||
{
|
{
|
||||||
// libxenon doesn't have proper synchronization primitives for this :(
|
// libxenon doesn't have proper synchronization primitives for this :(
|
||||||
udelay(50);
|
udelay(50);
|
||||||
@ -71,8 +72,11 @@ static ssize_t xenon360_write(void *data, const void *buf, size_t size)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (xenon_sound_get_free() >= size)
|
if (xenon_sound_get_unplayed() < MAX_BUFFER)
|
||||||
|
{
|
||||||
xenon_sound_submit(xa->buffer, size);
|
xenon_sound_submit(xa->buffer, size);
|
||||||
|
written = size;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return written;
|
return written;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user