From e0f2a469db11f667a0dfd03cade3f57841d90618 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Tue, 24 Nov 2009 07:16:28 +0000 Subject: [PATCH] Fine tune autoturn algorithm a bit. Let's hope games are smart enough to turn the keys off if they don't use the adlib anymore. (ripsaw) Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3501 --- src/hardware/adlib.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/hardware/adlib.cpp b/src/hardware/adlib.cpp index c3995a37..23311778 100644 --- a/src/hardware/adlib.cpp +++ b/src/hardware/adlib.cpp @@ -549,7 +549,10 @@ static void OPL_CallBack(Bitu len) { module->handler->Generate( module->mixerChan, len ); //Disable the sound generation after 30 seconds of silence if ((PIC_Ticks - module->lastUsed) > 30000) { - module->mixerChan->Enable(false); + Bitu i; + for (i=0xb0;i<0xb9;i++) if (module->cache[i]&0x20||module->cache[i+0x100]&0x20) break; + if (i==0xb9) module->mixerChan->Enable(false); + else module->lastUsed = PIC_Ticks; } }