From: Toni Wilen Date: Sat, 23 Oct 2021 16:51:25 +0000 (+0300) Subject: b33 audio period update fix. X-Git-Tag: 4900~39 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=2e5d87a906f79e7d534f44af7203f9290effac75;p=francis%2Fwinuae.git b33 audio period update fix. --- diff --git a/audio.cpp b/audio.cpp index 02255103..768b0bf7 100644 --- a/audio.cpp +++ b/audio.cpp @@ -119,7 +119,7 @@ struct audio_channel_data unsigned int evtime; bool dmaenstore; bool intreq2; - bool irqcheck; + int irqcheck; bool dr; bool dsr; bool pbufldl; @@ -1302,7 +1302,7 @@ static void zerostate (int nr) write_log (_T("%d: ZEROSTATE\n"), nr); #endif cdp->state = 0; - cdp->irqcheck = false; + cdp->irqcheck = 0; cdp->evtime = MAX_EV; cdp->intreq2 = 0; cdp->dmaenstore = false; @@ -1616,7 +1616,7 @@ static bool audio_state_channel2 (int nr, bool perfin) if (usehacks() && (currprefs.cachesize || (regs.instruction_cnt - cdp->dmaofftime_cpu_cnt) >= 60)) { if (warned >= 0) { warned--; - write_log(_T("Audio %d DMA wait hack: ENABLED. OFF=%08x, ON=%08x\n"), nr, cdp->dmaofftime_pc, M68K_GETPC); + write_log(_T("Audio %d DMA wait hack ENABLED. OFF=%08x, ON=%08x, PER=%d\n"), nr, cdp->dmaofftime_pc, M68K_GETPC, cdp->evtime / CYCLE_UNIT); } #if DEBUG_AUDIO_HACK > 0 if (debugchannel(nr)) @@ -1627,7 +1627,7 @@ static bool audio_state_channel2 (int nr, bool perfin) } else { if (warned >= 0) { warned--; - write_log(_T("Audio %d DMA wait hack: DISABLED. OFF=%08x, ON=%08x\n"), nr, cdp->dmaofftime_pc, M68K_GETPC); + write_log(_T("Audio %d DMA wait hack DISABLED. OFF=%08x, ON=%08x, PER=%d\n"), nr, cdp->dmaofftime_pc, M68K_GETPC, cdp->evtime / CYCLE_UNIT); } } cdp->dmaofftime_active = false; @@ -1769,7 +1769,7 @@ static bool audio_state_channel2 (int nr, bool perfin) setirq (nr, 22); } cdp->pbufldl = true; - cdp->irqcheck = false; + cdp->irqcheck = 0; cdp->state = 3; audio_state_channel2 (nr, false); break; @@ -1781,7 +1781,9 @@ static bool audio_state_channel2 (int nr, bool perfin) cdp->state = 3; loadper1(nr); if (!chan_ena && isirq(nr)) { - cdp->irqcheck = true; + cdp->irqcheck = 1; + } else { + cdp->irqcheck = -1; } return false; @@ -1823,7 +1825,11 @@ static bool audio_state_channel2 (int nr, bool perfin) if (napnav) setdr(nr, false); } else { - if (cdp->irqcheck) { + // cycle-accurate period check was not needed, do delayed check + if (!cdp->irqcheck) { + cdp->irqcheck = isirq(nr); + } + if (cdp->irqcheck > 0) { #if DEBUG_AUDIO > 0 if (debugchannel (nr)) write_log (_T("%d: IDLE\n"), nr);