GBA Audio: FIFOs should not poll DMAs that are not scheduled for audio

This commit is contained in:
Jeffrey Pfau 2015-04-04 22:07:46 -07:00
parent d3a0ce00db
commit 4a36c3766b
2 changed files with 9 additions and 4 deletions

View File

@ -4,6 +4,7 @@ Bugfixes:
- All: Fix sanitize-deb script not cleaning up after itself - All: Fix sanitize-deb script not cleaning up after itself
- Qt: Fix Display object leak when closing a window - Qt: Fix Display object leak when closing a window
- Qt: Fix .deb dependencies - Qt: Fix .deb dependencies
- GBA Audio: FIFOs should not poll DMAs that are not scheduled for audio
0.2.0: (2015-04-03) 0.2.0: (2015-04-03)
Features: Features:

View File

@ -514,11 +514,15 @@ void GBAAudioSampleFIFO(struct GBAAudio* audio, int fifoId, int32_t cycles) {
GBALog(audio->p, GBA_LOG_ERROR, "Bad FIFO write to address 0x%03x", fifoId); GBALog(audio->p, GBA_LOG_ERROR, "Bad FIFO write to address 0x%03x", fifoId);
return; return;
} }
if (CircleBufferSize(&channel->fifo) <= 4 * sizeof(int32_t)) { if (CircleBufferSize(&channel->fifo) <= 4 * sizeof(int32_t) && channel->dmaSource > 0) {
struct GBADMA* dma = &audio->p->memory.dma[channel->dmaSource]; struct GBADMA* dma = &audio->p->memory.dma[channel->dmaSource];
if (GBADMARegisterGetTiming(dma->reg) == DMA_TIMING_CUSTOM) {
dma->nextCount = 4; dma->nextCount = 4;
dma->nextEvent = 0; dma->nextEvent = 0;
GBAMemoryUpdateDMAs(audio->p, -cycles); GBAMemoryUpdateDMAs(audio->p, -cycles);
} else {
channel->dmaSource = 0;
}
} }
CircleBufferRead8(&channel->fifo, &channel->sample); CircleBufferRead8(&channel->fifo, &channel->sample);
} }