diff options
author | Simon Howard | 2014-10-28 22:27:36 -0400 |
---|---|---|
committer | Simon Howard | 2014-10-28 22:27:36 -0400 |
commit | 5a7a5402f74361dee7f2c6109eb46b83b4d17c16 (patch) | |
tree | beb5bc13596887c743dab2698c9702dd80f4b64c | |
parent | 5e064562c09ceb5b93a4ddafe734cdb6c7b081c6 (diff) | |
parent | cad5d6f20172bb441a75309d8db38f0c910aaa44 (diff) | |
download | chocolate-doom-5a7a5402f74361dee7f2c6109eb46b83b4d17c16.tar.gz chocolate-doom-5a7a5402f74361dee7f2c6109eb46b83b4d17c16.tar.bz2 chocolate-doom-5a7a5402f74361dee7f2c6109eb46b83b4d17c16.zip |
Merge pull request #467 from khokh2001/opl-fix3
Use MIDI note number 60 for percussion instruments, unless overridden
by the fixed_note field in the GENMIDI lump.
-rw-r--r-- | src/i_oplmusic.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/i_oplmusic.c b/src/i_oplmusic.c index a1e90506..b7c22384 100644 --- a/src/i_oplmusic.c +++ b/src/i_oplmusic.c @@ -812,6 +812,7 @@ static void UpdateVoiceFrequency(opl_voice_t *voice) static void VoiceKeyOn(opl_channel_data_t *channel, genmidi_instr_t *instrument, unsigned int instrument_voice, + unsigned int note, unsigned int key, unsigned int volume) { @@ -850,7 +851,7 @@ static void VoiceKeyOn(opl_channel_data_t *channel, } else { - voice->note = key; + voice->note = note; } // Program the voice with the instrument data: @@ -871,6 +872,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; unsigned int key; unsigned int volume; @@ -881,6 +883,7 @@ static void KeyOnEvent(opl_track_data_t *track, midi_event_t *event) event->data.channel.param2); */ + note = event->data.channel.param1; key = event->data.channel.param1; volume = event->data.channel.param2; @@ -909,6 +912,7 @@ static void KeyOnEvent(opl_track_data_t *track, midi_event_t *event) last_perc[last_perc_count] = key; last_perc_count = (last_perc_count + 1) % PERCUSSION_LOG_LEN; + note = 60; } else { @@ -918,11 +922,11 @@ 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. - VoiceKeyOn(channel, instrument, 0, key, volume); + VoiceKeyOn(channel, instrument, 0, note, key, volume); if ((SHORT(instrument->flags) & GENMIDI_FLAG_2VOICE) != 0) { - VoiceKeyOn(channel, instrument, 1, key, volume); + VoiceKeyOn(channel, instrument, 1, note, key, volume); } } |