From 72f854472370bee22337aba6bbdbfe0937b7c057 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Mon, 19 Nov 2018 18:34:49 +0000 Subject: [PATCH] Make autoinit exit work and prevent double single cycle transfers when quitting autoinit Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@4174 --- src/hardware/sblaster.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hardware/sblaster.cpp b/src/hardware/sblaster.cpp index 9058df08..4b68d63f 100644 --- a/src/hardware/sblaster.cpp +++ b/src/hardware/sblaster.cpp @@ -537,6 +537,8 @@ static void GenerateDMASound(Bitu size) { sb.dma.mode = DSP_DMA_NONE; } else { + //Copied this value as the count for the final single cycle + sb.dma.total = 0; LOG(LOG_SB, LOG_NORMAL)("Switch to Single cycle transfer begun"); } } else { @@ -996,6 +998,8 @@ static void DSP_DoCommand(void) { DSP_SB2_ABOVE; /* Set mode to single transfer so it ends with current block */ sb.dma.autoinit=false; //Should stop itself + sb.dma.total = 0; //This will cancel the switch to single cycle mode + //Should really have some sb.dma.autoexit variable since we don't support continue autoinit dsp commands break; case 0xe0: /* DSP Identification - SB2.0+ */ DSP_FlushData();