shithub: choc

Download patch

ref: cad5d6f20172bb441a75309d8db38f0c910aaa44
parent: 5e064562c09ceb5b93a4ddafe734cdb6c7b081c6
author: khokh2001 <alexeytf2@gmail.com>
date: Tue Oct 28 21:42:59 EDT 2014

opl drum note fix

fixed note drum instrument should be 60

--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -812,6 +812,7 @@
 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 @@
     }
     else
     {
-        voice->note = key;
+        voice->note = note;
     }
 
     // Program the voice with the instrument data:
@@ -871,6 +872,7 @@
 {
     genmidi_instr_t *instrument;
     opl_channel_data_t *channel;
+    unsigned int note;
     unsigned int key;
     unsigned int volume;
 
@@ -881,6 +883,7 @@
            event->data.channel.param2);
 */
 
+    note = event->data.channel.param1;
     key = event->data.channel.param1;
     volume = event->data.channel.param2;
 
@@ -909,6 +912,7 @@
 
         last_perc[last_perc_count] = key;
         last_perc_count = (last_perc_count + 1) % PERCUSSION_LOG_LEN;
+        note = 60;
     }
     else
     {
@@ -918,11 +922,11 @@
     // 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);
     }
 }