all repos — mgba @ 9f5626a748f4804df1d92c680c9af18a18d74f3f

mGBA Game Boy Advance Emulator

PSP2: Audio fixes
Vicki Pfau vi@endrift.com
Fri, 14 Sep 2018 20:22:23 -0700
commit

9f5626a748f4804df1d92c680c9af18a18d74f3f

parent

ab8321ac3471f8acfeba78ee434d5b73918bc34e

2 files changed, 5 insertions(+), 2 deletions(-)

jump to
M CHANGESCHANGES

@@ -50,6 +50,7 @@ - GB: Fix IRQ disabling on the same T-cycle as an assert

- Core: Fix ordering events when scheduling during events - GBA: Reset WAITCNT properly - GBA Serialize: Fix loading states in Hblank + - PSP2: Fix more issues causing poor audio Misc: - GBA Timer: Use global cycles for timers - GBA: Extend oddly-sized ROMs to full address space (fixes mgba.io/i/722)
M src/platform/psp2/psp2-context.csrc/platform/psp2/psp2-context.c

@@ -234,8 +234,7 @@

static void _postAudioBuffer(struct mAVStream* stream, blip_t* left, blip_t* right) { UNUSED(stream); MutexLock(&audioContext.mutex); - struct GBAStereoSample* samples = &audioContext.buffer[audioContext.writeOffset]; - while (audioContext.samples == PSP2_AUDIO_BUFFER_SIZE) { + while (audioContext.samples + PSP2_SAMPLES >= PSP2_AUDIO_BUFFER_SIZE) { if (!frameLimiter) { blip_clear(left); blip_clear(right);

@@ -244,6 +243,7 @@ return;

} ConditionWait(&audioContext.cond, &audioContext.mutex); } + struct GBAStereoSample* samples = &audioContext.buffer[audioContext.writeOffset]; blip_read_samples(left, &samples[0].left, PSP2_SAMPLES, true); blip_read_samples(right, &samples[0].right, PSP2_SAMPLES, true); audioContext.samples += PSP2_SAMPLES;

@@ -403,6 +403,8 @@ #endif

default: break; } + audioContext.running = false; + ThreadJoin(audioThread); } void mPSP2Paused(struct mGUIRunner* runner) {