mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 12:32:52 +00:00
try to fix audio pops on game loading on GX
This commit is contained in:
parent
4766675fa5
commit
d3047e6f59
@ -57,11 +57,14 @@ typedef struct
|
||||
} gx_audio_t;
|
||||
|
||||
static volatile gx_audio_t *gx_audio_data;
|
||||
static volatile bool stop_audio;
|
||||
|
||||
static void dma_callback(void)
|
||||
{
|
||||
gx_audio_t *wa = (gx_audio_t*)gx_audio_data;
|
||||
|
||||
if (!stop_audio)
|
||||
{
|
||||
/* Erase last chunk to avoid repeating audio. */
|
||||
memset(wa->data[wa->dma_busy], 0, CHUNK_SIZE);
|
||||
|
||||
@ -69,9 +72,11 @@ static void dma_callback(void)
|
||||
wa->dma_next = (wa->dma_next + 1) & (BLOCKS - 1);
|
||||
|
||||
DCFlushRange(wa->data[wa->dma_next], CHUNK_SIZE);
|
||||
|
||||
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
|
||||
|
||||
OSSignalCond(wa->cond);
|
||||
}
|
||||
}
|
||||
|
||||
static void *gx_audio_init(const char *device,
|
||||
@ -103,6 +108,7 @@ static void *gx_audio_init(const char *device,
|
||||
|
||||
wa->dma_write = BLOCKS - 1;
|
||||
DCFlushRange(wa->data, sizeof(wa->data));
|
||||
stop_audio = false;
|
||||
AIInitDMA((uint32_t)wa->data[wa->dma_next], CHUNK_SIZE);
|
||||
AIStartDMA();
|
||||
|
||||
@ -201,6 +207,7 @@ static void gx_audio_free(void *data)
|
||||
if (!wa)
|
||||
return;
|
||||
|
||||
stop_audio = true;
|
||||
AIStopDMA();
|
||||
AIRegisterDMACallback(NULL);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user