From: Shoichi Tamuki Date: Wed, 4 Mar 2009 09:51:36 +0000 (+0000) Subject: Fix to fit with MAX_CHANNELS > 32 X-Git-Tag: unkotim211~133 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=22c3c72ec2165a98b84d3834ba850b5c56fd73ab;p=timidity41%2Ftimidity41.git Fix to fit with MAX_CHANNELS > 32 --- diff --git a/ChangeLog b/ChangeLog index 636e1e8f..94c675cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-03-04 TAMUKI Shoichi + + * interface/ncurs_c.c, timidity/readmidi.c: + Fix to fit with MAX_CHANNELS > 32 + * timidity/playmidi.c (find_voice): Beautify + 2008-12-06 Keishi Suenaga * configure.in: Fix mingw detection and replace wsock32 by ws2_32. diff --git a/interface/ncurs_c.c b/interface/ncurs_c.c index 5967913d..1526daa1 100644 --- a/interface/ncurs_c.c +++ b/interface/ncurs_c.c @@ -729,38 +729,37 @@ static void display_intonation(int mode) static void ctl_ncurs_mode_init(void) { - int i; - - display_channels = LINES - 8; - if(display_channels > MAX_CHANNELS) - display_channels = MAX_CHANNELS; - if(current_file_info != NULL && current_file_info->max_channel < 16) - display_channels = 16; - - display_play_system(play_system_mode); - display_intonation(opt_pure_intonation); - switch(ctl_ncurs_mode) - { - case NCURS_MODE_MAIN: - touchwin(msgwin); - wrefresh(msgwin); - break; - case NCURS_MODE_TRACE: - touchwin(dftwin); - for(i = 0; i < MAX_CHANNELS; i++) - init_trace_window_chan(i); - N_ctl_refresh(); - break; - case NCURS_MODE_HELP: - break; - case NCURS_MODE_LIST: - touchwin(listwin); - ctl_list_mode(NC_LIST_NOW); - break; - case NCURS_MODE_DIR: - ctl_cmd_L_dir(0); - break; - } + int i; + + if (current_file_info != NULL) + display_channels = (current_file_info->max_channel / 16) * 16 + 16; + else + display_channels = LINES - 8; + if (display_channels > LINES - 8) + display_channels = LINES - 8; + display_play_system(play_system_mode); + display_intonation(opt_pure_intonation); + switch (ctl_ncurs_mode) { + case NCURS_MODE_MAIN: + touchwin(msgwin); + wrefresh(msgwin); + break; + case NCURS_MODE_TRACE: + touchwin(dftwin); + for (i = 0; i < MAX_CHANNELS; i++) + init_trace_window_chan(i); + N_ctl_refresh(); + break; + case NCURS_MODE_HELP: + break; + case NCURS_MODE_LIST: + touchwin(listwin); + ctl_list_mode(NC_LIST_NOW); + break; + case NCURS_MODE_DIR: + ctl_cmd_L_dir(0); + break; + } } static void display_key_helpmsg(void) diff --git a/timidity/playmidi.c b/timidity/playmidi.c index c578ab32..c4e76f65 100644 --- a/timidity/playmidi.c +++ b/timidity/playmidi.c @@ -2143,13 +2143,13 @@ static int find_voice(MidiEvent *e) finish_note(i); /* drop sustain */ else kill_note(i); - } else if (mono_check - || (altassign && find_altassign(altassign, voice[i].note))) + } else if (mono_check) kill_note(i); - else if (voice[i].note == note && - (channel[ch].assign_mode == 0 - || (channel[ch].assign_mode == 1 - && voice[i].proximate_flag == 0))) + else if (altassign && find_altassign(altassign, voice[i].note)) + kill_note(i); + else if (voice[i].note == note && (channel[ch].assign_mode == 0 + || channel[ch].assign_mode == 1 + && voice[i].proximate_flag == 0)) kill_note(i); } for (i = 0; i < upper_voices; i++) diff --git a/timidity/readmidi.c b/timidity/readmidi.c index 02aa49b6..599e3282 100644 --- a/timidity/readmidi.c +++ b/timidity/readmidi.c @@ -2833,7 +2833,7 @@ int parse_sysex_event_multi(uint8 *val, int32 len, MidiEvent *evm) 0, val[7], (val[0] == 0x7f)); num_events++; } else { - for (i = j = 0; i < MAX_CHANNELS; i++) + for (i = j = 0; i < 32; i++) if (channel_tt & 1 << i) { SETMIDIEVENT(evm[j], 0, ME_TEMPER_TYPE, MERGE_CHANNEL_PORT(i), @@ -3866,15 +3866,17 @@ static void move_channels(int *chidx) if (chidx[ch = e->event.channel] != -1) ch = e->event.channel = chidx[ch]; else { /* -1 */ - newch = ch % REDUCE_CHANNELS; - while (newch < ch && newch < MAX_CHANNELS) { - if (chidx[newch] == -1) { - ctl->cmsg(CMSG_INFO, VERB_VERBOSE, - "channel %d => %d", ch, newch); - ch = e->event.channel = chidx[ch] = newch; - break; + if (ch >= MAX_CHANNELS) { + newch = ch % REDUCE_CHANNELS; + while (newch < ch && newch < MAX_CHANNELS) { + if (chidx[newch] == -1) { + ctl->cmsg(CMSG_INFO, VERB_VERBOSE, + "channel %d => %d", ch, newch); + ch = e->event.channel = chidx[ch] = newch; + break; + } + newch += REDUCE_CHANNELS; } - newch += REDUCE_CHANNELS; } if (chidx[ch] == -1) { if (ch < MAX_CHANNELS)