From 5caa85d19ef851a015bcf63920e6911a441e4b1d Mon Sep 17 00:00:00 2001 From: Ralf Grillenberger Date: Sun, 29 Jul 2012 17:35:29 +0000 Subject: [PATCH] Use channel->SetFreq instead of creating and destroying the channel every time. Thus the mixer volume control for the Disney/Covox device remains available. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3787 --- src/hardware/disney.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hardware/disney.cpp b/src/hardware/disney.cpp index 52d7b8c6..3a9c48ac 100644 --- a/src/hardware/disney.cpp +++ b/src/hardware/disney.cpp @@ -69,11 +69,9 @@ static void DISNEY_disable(Bitu) { if(disney.mo) { disney.chan->AddSilence(); disney.chan->Enable(false); - delete disney.mo; } disney.leader = 0; disney.last_used = 0; - disney.mo = 0; disney.state = DS_IDLE; disney.interface_det = 0; disney.interface_det_ext = 0; @@ -90,8 +88,7 @@ static void DISNEY_enable(Bitu freq) { if(disney.stereo) LOG(LOG_MISC,LOG_NORMAL)("disney enable %d Hz, stereo",freq); else LOG(LOG_MISC,LOG_NORMAL)("disney enable %d Hz, mono",freq); #endif - disney.mo = new MixerObject(); - disney.chan=disney.mo->Install(&DISNEY_CallBack,freq,"DISNEY"); + disney.chan->SetFreq(freq); disney.chan->Enable(true); disney.state = DS_RUNNING; } @@ -377,11 +374,16 @@ public: disney.control=0; disney.last_used=0; - disney.mo=0; + disney.mo = new MixerObject(); + disney.chan=disney.mo->Install(&DISNEY_CallBack,10000,"DISNEY"); DISNEY_disable(0); + + } ~DISNEY(){ DISNEY_disable(0); + if (disney.mo) + delete disney.mo; } };