if (e->event.b == 0x45 && e->event.a != 0x10) { if (maxch < e->event.a) maxch = e->event.a; } else if (e->event.b == 0x46) { if (maxch < e->event.a) maxch = e->event.a; }
if (e->event.b == 0x45 || e->event.b == 0x46) if (maxch < e->event.channel) maxch = e->event.channel;
static void move_channels(int *chidx){	int i, ch, maxch, newch;	MidiEventList *e;		for (i = 0; i < 256; i++)		chidx[i] = -1;	/* check channels */	for (i = maxch = 0, e = evlist; i < event_count; i++, e = e->next)		if (! GLOBAL_CHANNEL_EVENT_TYPE(e->event.type)) {			if ((ch = e->event.channel) < REDUCE_CHANNELS)				chidx[ch] = ch;			if (maxch < ch)				maxch = ch;		}	if (maxch >= REDUCE_CHANNELS)		/* Move channel if enable */		for (i = maxch = 0, e = evlist; i < event_count; i++, e = e->next)			if (! GLOBAL_CHANNEL_EVENT_TYPE(e->event.type)) {				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;						}						newch += REDUCE_CHANNELS;					}					if (chidx[ch] == -1) {						if (ch < MAX_CHANNELS)							chidx[ch] = ch;						else {							newch = ch % MAX_CHANNELS;							ctl->cmsg(CMSG_WARNING, VERB_VERBOSE,									"channel %d => %d (mixed)", ch, newch);							ch = e->event.channel = chidx[ch] = newch;						}					}				}				if (maxch < ch)					maxch = ch;			}	for (i = 0, e = evlist; i < event_count; i++, e = e->next)		if (e->event.type == ME_SYSEX_GS_LSB) {			if (e->event.b == 0x45 && e->event.a != 0x10) {				if (maxch < e->event.a)					maxch = e->event.a;			} else if (e->event.b == 0x46) {				if (maxch < e->event.a)					maxch = e->event.a;			}		} else if (e->event.type == ME_SYSEX_XG_LSB) {			if (e->event.b == 0x65 && e->event.a != 0x7f) {				if (maxch < e->event.a)					maxch = e->event.a;			}		}	current_file_info->max_channel = maxch;}