diff options
author | Simon Howard | 2015-06-08 20:58:48 -0400 |
---|---|---|
committer | Simon Howard | 2015-06-08 20:58:48 -0400 |
commit | e81997d7571cbe9372c4fe66b644d0d9a5059b6f (patch) | |
tree | 19e6095a4446bbf5af4d1ab48dc650d2755974d2 /src/i_oplmusic.c | |
parent | e986a93409fd717fd01c93199c84ac5788bafebe (diff) | |
download | chocolate-doom-e81997d7571cbe9372c4fe66b644d0d9a5059b6f.tar.gz chocolate-doom-e81997d7571cbe9372c4fe66b644d0d9a5059b6f.tar.bz2 chocolate-doom-e81997d7571cbe9372c4fe66b644d0d9a5059b6f.zip |
Replace "opl_type" config variable with DMXOPTION.
Vanilla Doom used the DMXOPTION environment variable to control
whether OPL3 output was generated. Emulate this, and use a config
file variable that can set DMXOPTION without needing to configure
it via an environment variable.
Diffstat (limited to 'src/i_oplmusic.c')
-rw-r--r-- | src/i_oplmusic.c | 13 |
1 files changed, 11 insertions, 2 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; |