From b859a063c022246afaf9b22d47f0c0f745bf8cf6 Mon Sep 17 00:00:00 2001 From: Sjoerd van der Berg Date: Mon, 31 Mar 2003 08:06:57 +0000 Subject: [PATCH] Saving of pit modes for better switching Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@851 --- src/hardware/pcspeaker.cpp | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/hardware/pcspeaker.cpp b/src/hardware/pcspeaker.cpp index 44ebfc65..85a255af 100644 --- a/src/hardware/pcspeaker.cpp +++ b/src/hardware/pcspeaker.cpp @@ -38,12 +38,17 @@ enum SPKR_MODE { MODE_NONE,MODE_WAVE,MODE_DELAY,MODE_ONOFF,MODE_REAL, }; +/* TODO + Maybe interpolate at the moment we switch between on/off + Keep track of postion of speaker conus in ONOFF mode +*/ static struct { Bit16s volume; MIXER_Channel * chan; Bit16u buffer[SPKR_BUF]; - SPKR_MODE mode,old_mode; + SPKR_MODE mode; + SPKR_MODE pit_mode; struct { Bit16s buf[SPKR_BUF]; Bitu used; @@ -68,11 +73,10 @@ static struct { Bitu rate_conv; Bitu tick_add; } hw; - bool onoff; + bool onoff,enabled; Bitu buf_pos; } spkr; -/* TODO Maybe interpolate at the moment we switch between on/off */ static void GenerateSound(Bitu size) { while (spkr.out.pos72) cntr=72; if (spkr.mode!=MODE_REAL) GenerateSound(len); - spkr.mode=MODE_REAL; + spkr.pit_mode=MODE_REAL; if (spkr.real.used(sec); if(!section->Get_bool("enabled")) return; spkr.volume=SPKR_VOLUME; - spkr.old_mode=spkr.mode=MODE_NONE; + spkr.mode=MODE_NONE; + spkr.pit_mode=MODE_WAVE; spkr.real.used=0; spkr.out.pos=0; + spkr.onoff=false; // spkr.hw.vol=section->Get_int("volume"); spkr.hw.rate=section->Get_int("pcrate"); spkr.hw.rate_conv=(spkr.hw.rate<<16)/1000000;