1
0
Fork 0

Unload CMS/Gameblaster when sbtype is changed. Add GUS FM forwarding when Gameblaster is selected. Make some CMS tables const.

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@3566
This commit is contained in:
Ralf Grillenberger 2010-04-04 10:23:16 +00:00
parent 953cf4d318
commit 461ffb6c40
2 changed files with 29 additions and 28 deletions

View file

@ -80,7 +80,7 @@ struct SAA1099
struct saa1099_noise noise[2]; /* noise generators */
};
static UINT8 envelope[8][64] = {
static const UINT8 envelope[8][64] = {
/* zero amplitude */
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@ -124,7 +124,7 @@ static UINT8 envelope[8][64] = {
};
static int amplitude_lookup[16] = {
static const int amplitude_lookup[16] = {
0*32767/16, 1*32767/16, 2*32767/16, 3*32767/16,
4*32767/16, 5*32767/16, 6*32767/16, 7*32767/16,
8*32767/16, 9*32767/16, 10*32767/16, 11*32767/16,

View file

@ -1469,6 +1469,7 @@ private:
IO_WriteHandleObject WriteHandler[0x10];
AutoexecObject autoexecline;
MixerObject MixerChan;
OPL_Mode oplmode;
/* Support Functions */
void Find_Type_And_Opl(Section_prop* config,SB_TYPES& type, OPL_Mode& opl_mode){
@ -1497,14 +1498,22 @@ private:
else {
switch (type) {
case SBT_NONE:
opl_mode=OPL_none;
break;
case SBT_GB:
opl_mode=OPL_none;break;
case SBT_1:opl_mode=OPL_opl2;break;
case SBT_2:opl_mode=OPL_opl2;break;
case SBT_PRO1:opl_mode=OPL_dualopl2;break;
opl_mode=OPL_cms;
break;
case SBT_1:
case SBT_2:
opl_mode=OPL_opl2;
break;
case SBT_PRO1:
opl_mode=OPL_dualopl2;
break;
case SBT_PRO2:
case SBT_16:
opl_mode=OPL_opl3;break;
opl_mode=OPL_opl3;
break;
}
}
}
@ -1524,27 +1533,25 @@ public:
sb.mixer.enabled=section->Get_bool("sbmixer");
sb.mixer.stereo=false;
OPL_Mode opl_mode = OPL_none;
Find_Type_And_Opl(section,sb.type,opl_mode);
bool do_cms = (sb.type==SBT_GB)? true:false;
switch (opl_mode) {
Find_Type_And_Opl(section,sb.type,oplmode);
switch (oplmode) {
case OPL_none:
WriteHandler[0].Install(0x388,adlib_gusforward,IO_MB);
break;
case OPL_cms:
WriteHandler[0].Install(0x388,adlib_gusforward,IO_MB);
do_cms = true;
CMS_Init(section);
break;
case OPL_opl2:
do_cms = true;
CMS_Init(section);
// fall-through
case OPL_dualopl2:
case OPL_opl3:
OPL_Init(section,opl_mode);
OPL_Init(section,oplmode);
break;
}
if (do_cms) CMS_Init(section);
if (sb.type==SBT_NONE || sb.type==SBT_GB) return;
sb.chan=MixerChan.Install(&SBLASTER_CallBack,22050,"SB");
@ -1588,28 +1595,22 @@ public:
}
~SBLASTER() {
Section_prop * section=static_cast<Section_prop *>(m_configuration);
OPL_Mode opl_mode = OPL_none;
Find_Type_And_Opl(section,sb.type,opl_mode);
switch (opl_mode) {
switch (oplmode) {
case OPL_none:
break;
case OPL_cms:
CMS_ShutDown(m_configuration);
CMS_ShutDown(m_configuration);
break;
case OPL_opl2:
CMS_ShutDown(m_configuration);
CMS_ShutDown(m_configuration);
// fall-through
case OPL_dualopl2:
case OPL_opl3:
OPL_ShutDown(m_configuration);
OPL_ShutDown(m_configuration);
break;
}
if (sb.type==SBT_NONE || sb.type==SBT_GB) return;
DSP_Reset();//Stop everything
DSP_Reset(); // Stop everything
}
}; //End of SBLASTER class