summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i_oplmusic.c13
-rw-r--r--src/i_sound.c4
-rw-r--r--src/m_config.c12
-rw-r--r--src/setup/sound.c46
4 files changed, 63 insertions, 12 deletions
diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index cbdbc329..f98f2c91 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -349,8 +349,8 @@ static unsigned int last_perc_count;
// Configuration file variable, containing the port number for the
// adlib chip.
+char *snd_dmxoption = "";
int opl_io_port = 0x388;
-int opl_type = 0;
// Load instrument table from GENMIDI lump:
@@ -1650,6 +1650,7 @@ static void I_OPL_ShutdownMusic(void)
static boolean I_OPL_InitMusic(void)
{
+ char *dmxoption;
int opl_chip_type;
OPL_SetSampleRate(snd_samplerate);
@@ -1661,7 +1662,15 @@ static boolean I_OPL_InitMusic(void)
return false;
}
- if (opl_chip_type == 2 && opl_type)
+ // The DMXOPTION variable must be set to enable OPL3 support.
+ // As an extension, we also allow it to be set from the config file.
+ dmxoption = getenv("DMXOPTION");
+ if (dmxoption == NULL)
+ {
+ dmxoption = snd_dmxoption != NULL ? snd_dmxoption : "";
+ }
+
+ if (opl_chip_type == 2 && strstr(dmxoption, "-opl3") != NULL)
{
opl_opl3mode = 1;
num_opl_voices = OPL_NUM_VOICES * 2;
diff --git a/src/i_sound.c b/src/i_sound.c
index 03a9facc..a646aed1 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -68,7 +68,6 @@ extern music_module_t music_opl_module;
extern opl_driver_ver_t opl_drv_ver;
extern int opl_io_port;
-extern int opl_type;
// For native music module:
@@ -433,6 +432,7 @@ boolean I_MusicIsPlaying(void)
void I_BindSoundVariables(void)
{
+ extern char *snd_dmxoption;
extern int use_libsamplerate;
extern float libsamplerate_scale;
@@ -444,10 +444,10 @@ void I_BindSoundVariables(void)
M_BindIntVariable("snd_mport", &snd_mport);
M_BindIntVariable("snd_maxslicetime_ms", &snd_maxslicetime_ms);
M_BindStringVariable("snd_musiccmd", &snd_musiccmd);
+ M_BindStringVariable("snd_dmxoption", &snd_dmxoption);
M_BindIntVariable("snd_samplerate", &snd_samplerate);
M_BindIntVariable("snd_cachesize", &snd_cachesize);
M_BindIntVariable("opl_io_port", &opl_io_port);
- M_BindIntVariable("opl_type", &opl_type);
M_BindStringVariable("timidity_cfg_path", &timidity_cfg_path);
M_BindStringVariable("gus_patch_path", &gus_patch_path);
diff --git a/src/m_config.c b/src/m_config.c
index 3ec0b633..a993eebd 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -817,6 +817,13 @@ static default_t extra_defaults_list[] =
CONFIG_VARIABLE_STRING(snd_musiccmd),
//!
+ // Value to set for the DMXOPTION environment variable. If this contains
+ // "-opl3", output for an OPL3 chip is generated when in OPL MIDI
+ // playback mode.
+ //
+ CONFIG_VARIABLE_STRING(snd_dmxoption),
+
+ //!
// The I/O port to use to access the OPL chip. Only relevant when
// using native OPL music playback.
//
@@ -824,11 +831,6 @@ static default_t extra_defaults_list[] =
CONFIG_VARIABLE_INT_HEX(opl_io_port),
//!
- // OPL chip type.
- //
- CONFIG_VARIABLE_INT(opl_type),
-
- //!
// @game doom heretic strife
//
// If non-zero, the ENDOOM text screen is displayed when exiting the
diff --git a/src/setup/sound.c b/src/setup/sound.c
index 092a5dd8..fe9b2c78 100644
--- a/src/setup/sound.c
+++ b/src/setup/sound.c
@@ -61,6 +61,13 @@ static char *musicmode_strings[] =
"CD audio"
};
+typedef enum
+{
+ OPLMODE_OPL2,
+ OPLMODE_OPL3,
+ NUM_OPLMODES,
+} oplmode_t;
+
static char *opltype_strings[] =
{
"OPL2",
@@ -87,10 +94,10 @@ static int show_talk = 0;
static int use_libsamplerate = 0;
static float libsamplerate_scale = 0.65;
+static char *snd_dmxoption = "";
static char *timidity_cfg_path = NULL;
static char *gus_patch_path = NULL;
static int gus_ram_kb = 1024;
-static int opl_type = 0;
// DOS specific variables: these are unused but should be maintained
// so that the config file can be shared between chocolate
@@ -105,6 +112,7 @@ static int snd_mport = 0;
static int snd_sfxmode;
static int snd_musicmode;
+static int snd_oplmode;
static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data))
{
@@ -139,6 +147,38 @@ static void UpdateSndDevices(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(data))
snd_musicdevice = SNDDEVICE_CD;
break;
}
+
+ switch (snd_oplmode)
+ {
+ default:
+ case OPLMODE_OPL2:
+ snd_dmxoption = "";
+ break;
+
+ case OPLMODE_OPL3:
+ snd_dmxoption = "-opl3";
+ break;
+ }
+}
+
+static txt_dropdown_list_t *OPLTypeSelector(void)
+{
+ txt_dropdown_list_t *result;
+
+ if (snd_dmxoption != NULL && strstr(snd_dmxoption, "-opl3") != NULL)
+ {
+ snd_oplmode = OPLMODE_OPL3;
+ }
+ else
+ {
+ snd_oplmode = OPLMODE_OPL2;
+ }
+
+ result = TXT_NewDropdownList(&snd_oplmode, opltype_strings, 2);
+
+ TXT_SignalConnect(result, "changed", UpdateSndDevices, NULL);
+
+ return result;
}
static void UpdateExtraTable(TXT_UNCAST_ARG(widget),
@@ -153,7 +193,7 @@ static void UpdateExtraTable(TXT_UNCAST_ARG(widget),
TXT_SetColumnWidths(extra_table, 19, 4);
TXT_AddWidgets(extra_table,
TXT_NewLabel("OPL type"),
- TXT_NewDropdownList(&opl_type, opltype_strings, 2),
+ OPLTypeSelector(),
NULL);
break;
@@ -335,10 +375,10 @@ void BindSoundVariables(void)
M_BindIntVariable("snd_mport", &snd_mport);
M_BindIntVariable("snd_maxslicetime_ms", &snd_maxslicetime_ms);
M_BindStringVariable("snd_musiccmd", &snd_musiccmd);
+ M_BindStringVariable("snd_dmxoption", &snd_dmxoption);
M_BindIntVariable("snd_cachesize", &snd_cachesize);
M_BindIntVariable("opl_io_port", &opl_io_port);
- M_BindIntVariable("opl_type", &opl_type);
if (gamemission == strife)
{