PSP2: Audio fixes

This commit is contained in:
Vicki Pfau 2018-09-14 20:22:23 -07:00
parent ab8321ac34
commit 9f5626a748
2 changed files with 5 additions and 2 deletions

View File

@ -50,6 +50,7 @@ Bugfixes:
- 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)

View File

@ -234,8 +234,7 @@ static void _requestImage(struct mImageSource* source, const void** buffer, size
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 @@ static void _postAudioBuffer(struct mAVStream* stream, blip_t* left, blip_t* rig
}
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 @@ void mPSP2UnloadROM(struct mGUIRunner* runner) {
default:
break;
}
audioContext.running = false;
ThreadJoin(audioThread);
}
void mPSP2Paused(struct mGUIRunner* runner) {