shithub: choc

Download patch

ref: 0cada1cf6fd7b5cdcf41b5638b35d779b430efb8
parent: 98e1771a832f0843d1a8be344894c0c77bd5f8fd
author: khokh2001 <alexeytf2@gmail.com>
date: Wed Oct 29 12:52:36 EDT 2014

Update i_oplmusic.c

--- a/src/i_oplmusic.c
+++ b/src/i_oplmusic.c
@@ -715,10 +715,10 @@
 static unsigned int FrequencyForVoice(opl_voice_t *voice)
 {
     genmidi_voice_t *gm_voice;
-    unsigned int freq_index;
+    signed int freq_index;
     unsigned int octave;
     unsigned int sub_index;
-    unsigned int note;
+    signed int note;
 
     note = voice->note;
 
@@ -754,6 +754,11 @@
         freq_index += (voice->current_instr->fine_tuning / 2) - 64;
     }
 
+    if (freq_index < 0)
+    {
+    	freq_index = 0;
+    }
+    
     // The first 7 notes use the start of the table, while
     // consecutive notes loop around the latter part.