all repos — mgba @ bc2979679e71144567e14e696d859e17ae291c8d

mGBA Game Boy Advance Emulator

Write audio FIFO in discrete chunks to avoid ordering issues
Jeffrey Pfau jeffrey@endrift.com
Tue, 07 Oct 2014 01:54:02 -0700
commit

bc2979679e71144567e14e696d859e17ae291c8d

parent

54bda1757ee644e8bca278007f928d6fca9c4202

1 files changed, 6 insertions(+), 3 deletions(-)

jump to
M src/gba/gba-audio.csrc/gba/gba-audio.c

@@ -437,9 +437,12 @@ default:

GBALog(audio->p, GBA_LOG_ERROR, "Bad FIFO write to address 0x%03x", address); return; } - while (!CircleBufferWrite32(fifo, value)) { - int32_t dummy; - CircleBufferRead32(fifo, &dummy); + int i; + for (i = 0; i < 4; ++i) { + while (!CircleBufferWrite8(fifo, value >> (8 * i))) { + int8_t dummy; + CircleBufferRead8(fifo, &dummy); + } } }