summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/i_oplmusic.c31
-rw-r--r--src/i_sound.c5
-rw-r--r--src/i_sound.h5
3 files changed, 23 insertions, 18 deletions
diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c
index 2df361e5..54f92465 100644
--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -297,7 +297,7 @@ static const unsigned int volume_mapping_table[] = {
124, 124, 125, 125, 126, 126, 127, 127
};
-opl_driver_ver_t opl_drv_ver = opl_v_new;
+static opl_driver_ver_t opl_drv_ver = opl_v_new;
static boolean music_initialized = false;
//static boolean musicpaused = false;
@@ -433,12 +433,12 @@ static void ReleaseVoice(opl_voice_t *voice)
{
opl_voice_t **rover;
opl_voice_t *next;
- boolean doublev;
+ boolean double_voice;
voice->channel = NULL;
voice->note = 0;
- doublev = voice->current_instr_voice != 0;
+ double_voice = voice->current_instr_voice != 0;
next = voice->next;
// Remove from alloced list.
@@ -457,7 +457,7 @@ static void ReleaseVoice(opl_voice_t *voice)
*rover = voice;
voice->next = NULL;
- if (next != NULL && doublev && opl_drv_ver == opl_v_old)
+ if (next != NULL && double_voice && opl_drv_ver == opl_v_old)
{
VoiceKeyOff(next);
ReleaseVoice(next);
@@ -684,7 +684,7 @@ static void KeyOffEvent(opl_track_data_t *track, midi_event_t *event)
rover = voice_alloced_list;
prev = NULL;
- while (rover!=NULL)
+ while (rover != NULL)
{
if (rover->channel == channel && rover->key == key)
{
@@ -744,6 +744,9 @@ static void ReplaceExistingVoice(void)
ReleaseVoice(result);
}
+// Alternate version of ReplaceExistingVoice() used when emulating old
+// versions of the DMX library used in Heretic and Hexen.
+
static void ReplaceExistingVoiceOld(opl_channel_data_t *channel)
{
opl_voice_t *rover;
@@ -930,7 +933,7 @@ static void KeyOnEvent(opl_track_data_t *track, midi_event_t *event)
genmidi_instr_t *instrument;
opl_channel_data_t *channel;
unsigned int note, key, volume;
- boolean doublev;
+ boolean double_voice;
/*
printf("note on: channel %i, %i, %i\n",
@@ -973,15 +976,16 @@ static void KeyOnEvent(opl_track_data_t *track, midi_event_t *event)
{
instrument = channel->instrument;
}
- doublev = (SHORT(instrument->flags) & GENMIDI_FLAG_2VOICE) != 0;
- if (opl_drv_ver == opl_v_old)
+ double_voice = (SHORT(instrument->flags) & GENMIDI_FLAG_2VOICE) != 0;
+
+ if (opl_drv_ver == opl_v_old)
{
if (voice_alloced_num == OPL_NUM_VOICES)
{
ReplaceExistingVoiceOld(channel);
}
- if (voice_alloced_num == OPL_NUM_VOICES - 1 && doublev)
+ if (voice_alloced_num == OPL_NUM_VOICES - 1 && double_voice)
{
ReplaceExistingVoiceOld(channel);
}
@@ -989,7 +993,7 @@ static void KeyOnEvent(opl_track_data_t *track, midi_event_t *event)
// Find and program a voice for this instrument. If this
// is a double voice instrument, we must do this twice.
- if (doublev)
+ if (double_voice)
{
VoiceKeyOn(channel, instrument, 1, note, key, volume);
}
@@ -1008,7 +1012,7 @@ static void KeyOnEvent(opl_track_data_t *track, midi_event_t *event)
VoiceKeyOn(channel, instrument, 0, note, key, volume);
- if (doublev)
+ if (double_voice)
{
VoiceKeyOn(channel, instrument, 1, note, key, volume);
}
@@ -1626,6 +1630,11 @@ music_module_t music_opl_module =
NULL, // Poll
};
+void I_SetOPLDriverVer(opl_driver_ver_t ver)
+{
+ opl_drv_ver = ver;
+}
+
//----------------------------------------------------------------------
//
// Development / debug message generation, to help developing GENMIDI
diff --git a/src/i_sound.c b/src/i_sound.c
index 6763fa37..73442cbd 100644
--- a/src/i_sound.c
+++ b/src/i_sound.c
@@ -473,8 +473,3 @@ void I_BindSoundVariables(void)
#endif
}
-void I_SetOPLDriverVer(opl_driver_ver_t ver)
-{
- opl_drv_ver = ver;
-}
-
diff --git a/src/i_sound.h b/src/i_sound.h
index a240c48b..4490b96a 100644
--- a/src/i_sound.h
+++ b/src/i_sound.h
@@ -234,9 +234,10 @@ extern char *snd_musiccmd;
void I_BindSoundVariables(void);
+// DMX version to emulate for OPL emulation:
typedef enum {
- opl_v_old, // hexen heretic
- opl_v_new // doom strife
+ opl_v_old, // Hexen, Heretic
+ opl_v_new // Doom, Strife
} opl_driver_ver_t;
void I_SetOPLDriverVer(opl_driver_ver_t ver);