]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
b33 audio period update fix.
authorToni Wilen <twilen@winuae.net>
Sat, 23 Oct 2021 16:51:25 +0000 (19:51 +0300)
committerToni Wilen <twilen@winuae.net>
Sat, 23 Oct 2021 16:51:25 +0000 (19:51 +0300)
audio.cpp

index 022551033dcfb2212af3c7589181cb86c638fbc3..768b0bf707b4c1fa77863b2375832d88fddef2ac 100644 (file)
--- 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);