OSDN Git Service

TiMidity++-2.10.4
[timidity41/timidity41.git] / timidity / playmidi.c
index 8f4cdcc..facb1f9 100644 (file)
@@ -2131,8 +2131,13 @@ void midi_program_change(int ch, int prog)
        switch(channel[ch].bank_msb)
        {
          case 0: /* Normal */
-           midi_drumpart_change(ch, 0);
-           channel[ch].mapID = XG_NORMAL_MAP;
+           if(ch == 9  && channel[ch].bank_lsb == 127 && channel[ch].mapID == XG_DRUM_MAP) {
+             /* FIXME: Why this part is drum?  Is this correct? */
+             ;
+           } else {
+             midi_drumpart_change(ch, 0);
+             channel[ch].mapID = XG_NORMAL_MAP;
+           }
            break;
          case 64: /* SFX voice */
            midi_drumpart_change(ch, 0);
@@ -2165,6 +2170,7 @@ void midi_program_change(int ch, int prog)
            channel[ch].altassign = drumset[0]->alt;
        else
            channel[ch].altassign = drumset[prog]->alt;
+       ctl_mode_event(CTLE_DRUMPART, 1, ch, 1);
     }
     else
     {
@@ -2172,6 +2178,7 @@ void midi_program_change(int ch, int prog)
            newbank = special_tonebank;
        channel[ch].bank = newbank;
        channel[ch].altassign = NULL;
+       ctl_mode_event(CTLE_DRUMPART, 1, ch, 0);
     }
 
     if(!dr && default_program[ch] == SPECIAL_PROGRAM)
@@ -3606,7 +3613,8 @@ static int compute_data(int32 count)
       /* Auto voice reduce implementation by Masanao Izumo */
       if(reduce_voice_threshold &&
         (play_mode->flag & PF_CAN_TRACE) &&
-        !aq_fill_buffer_flag)
+        !aq_fill_buffer_flag &&
+        aq_get_dev_queuesize() > 0)
       {
          /* Reduce voices if there is not enough audio device buffer */
 
@@ -4238,6 +4246,12 @@ static int play_midi(MidiEvent *eventlist, int32 samples)
        return rc;
 
     skip_to(midi_restart_time);
+
+    if(midi_restart_time > 0) { /* Need to update interface display */
+      int i;
+      for(i = 0; i < MAX_CHANNELS; i++)
+       redraw_controllers(i);
+    }
     rc = RC_NONE;
     for(;;)
     {
@@ -4525,6 +4539,7 @@ int play_midi_file(char *fn)
        free(event);
     if(rc == RC_RELOAD)
        goto play_reload;
+
     if(rc == RC_ERROR)
     {
        if(current_file_info->file_type == IS_OTHER_FILE)