|| (opt_drum_effect && ISDRUMCHANNEL(i))) { 
|| (opt_drum_effect && ISDRUMCHANNEL(i)) || is_insertion_effect_xg(i)) { 
static void do_compute_data_midi(int32 count){	int i, j, uv, stereo, n, ch, note;	int32 *vpblist[MAX_CHANNELS];	int channel_effect, channel_reverb, channel_chorus, channel_delay, channel_eq;	int32 cnt = count * 2, rev_max_delay_out;	struct DrumPartEffect *de;		stereo = ! (play_mode->encoding & PE_MONO);	n = count * ((stereo) ? 8 : 4); /* in bytes */	memset(buffer_pointer, 0, n);	memset(insertion_effect_buffer, 0, n);	if (opt_reverb_control == 3) {		rev_max_delay_out = 0x7fffffff;	/* disable */	} else {		rev_max_delay_out = REVERB_MAX_DELAY_OUT;	}	/* are effects valid? / don't supported in mono */	channel_reverb = (stereo && (opt_reverb_control == 1			|| opt_reverb_control == 3			|| (opt_reverb_control < 0 && opt_reverb_control & 0x80)));	channel_chorus = (stereo && opt_chorus_control);	channel_delay = (stereo && opt_delay_control > 0);	/* is EQ valid? */	channel_eq = opt_eq_control && (eq_status_gs.low_gain != 0x40 || eq_status_gs.high_gain != 0x40 ||		play_system_mode == XG_SYSTEM_MODE);	channel_effect = (stereo && (channel_reverb || channel_chorus			|| channel_delay || channel_eq || opt_insertion_effect));	uv = upper_voices;	for(i = 0; i < uv; i++) {		if(voice[i].status != VOICE_FREE) {			channel[voice[i].channel].lasttime = current_sample + count;		}	}	/* appropriate buffers for channels */	if(channel_effect) {		int buf_index = 0;				if(reverb_buffer == NULL) {	/* allocating buffer for channel effect */			reverb_buffer = (char *)safe_malloc(MAX_CHANNELS * AUDIO_BUFFER_SIZE * 8);		}		for(i = 0; i < MAX_CHANNELS; i++) {			if(opt_insertion_effect && channel[i].insertion_effect) {				vpblist[i] = insertion_effect_buffer;			} else if(channel[i].eq_gs || (get_reverb_level(i) != DEFAULT_REVERB_SEND_LEVEL					&& current_sample - channel[i].lasttime < rev_max_delay_out)					|| channel[i].chorus_level > 0 || channel[i].delay_level > 0					|| channel[i].eq_xg.valid					|| channel[i].dry_level != 127					|| (opt_drum_effect && ISDRUMCHANNEL(i))) {				vpblist[i] = (int32*)(reverb_buffer + buf_index);				buf_index += n;			} else {				vpblist[i] = buffer_pointer;			}			/* clear buffers of drum-part effect */			if (opt_drum_effect && ISDRUMCHANNEL(i)) {				for (j = 0; j < channel[i].drum_effect_num; j++) {					if (channel[i].drum_effect[j].buf != NULL) {						memset(channel[i].drum_effect[j].buf, 0, n);					}				}			}		}		if(buf_index) {memset(reverb_buffer, 0, buf_index);}	}	for (i = 0; i < uv; i++) {		if (voice[i].status != VOICE_FREE) {			int32 *vpb;			int8 flag;						if (channel_effect) {				flag = 0;				ch = voice[i].channel;				if (opt_drum_effect && ISDRUMCHANNEL(ch)) {					make_drum_effect(ch);					note = voice[i].note;					for (j = 0; j < channel[ch].drum_effect_num; j++) {						if (channel[ch].drum_effect[j].note == note) {							vpb = channel[ch].drum_effect[j].buf;							flag = 1;						}					}					if (flag == 0) {vpb = vpblist[ch];}				} else {					vpb = vpblist[ch];				}			} else {				vpb = buffer_pointer;			}			if(!IS_SET_CHANNELMASK(channel_mute, voice[i].channel)) {				mix_voice(vpb, i, count);			} else {				free_voice(i);				ctl_note_event(i);			}			if(voice[i].timeout == 1 && voice[i].timeout < current_sample) {				free_voice(i);				ctl_note_event(i);			}		}	}	while(uv > 0 && voice[uv - 1].status == VOICE_FREE)	{uv--;}	upper_voices = uv;	if(play_system_mode == XG_SYSTEM_MODE && channel_effect) {	/* XG */		for(i = 0; i < MAX_CHANNELS; i++) {	/* system effects */			int32 *p;			p = vpblist[i];			if(p != buffer_pointer) {				if (opt_drum_effect && ISDRUMCHANNEL(i)) {					for (j = 0; j < channel[i].drum_effect_num; j++) {						de = &(channel[i].drum_effect[j]);						if (de->reverb_send > 0) {							set_ch_reverb(de->buf, cnt, de->reverb_send);						}						if (de->chorus_send > 0) {							set_ch_chorus(de->buf, cnt, de->chorus_send);						}						if (de->delay_send > 0) {							set_ch_delay(de->buf, cnt, de->delay_send);						}						mix_signal(p, de->buf, cnt);					}				} else {					if(channel_eq && channel[i].eq_xg.valid) {						do_ch_eq_xg(p, cnt, &(channel[i].eq_xg));					}					if(channel_chorus && channel[i].chorus_level > 0) {						set_ch_chorus(p, cnt, channel[i].chorus_level);					}					if(channel_delay && channel[i].delay_level > 0) {						set_ch_delay(p, cnt, channel[i].delay_level);					}					if(channel_reverb && channel[i].reverb_level > 0						&& current_sample - channel[i].lasttime < rev_max_delay_out) {						set_ch_reverb(p, cnt, channel[i].reverb_level);					}				}				if(channel[i].dry_level == 127) {					set_dry_signal(p, cnt);				} else {					set_dry_signal_xg(p, cnt, channel[i].dry_level);				}			}		}				if(channel_reverb) {			set_ch_reverb(buffer_pointer, cnt, DEFAULT_REVERB_SEND_LEVEL);		}		set_dry_signal(buffer_pointer, cnt);		/* mixing signal and applying system effects */ 		mix_dry_signal(buffer_pointer, cnt);		if(channel_chorus) {do_ch_chorus(buffer_pointer, cnt);}		if(channel_delay) {do_ch_delay(buffer_pointer, cnt);}		if(channel_reverb) {do_ch_reverb(buffer_pointer, cnt);}		if(multi_eq_xg.valid) {do_multi_eq_xg(buffer_pointer, cnt);}	} else if(channel_effect) {	/* GM & GS */		if(opt_insertion_effect) { 	/* insertion effect */			/* applying insertion effect */			do_insertion_effect_gs(insertion_effect_buffer, cnt);			/* sending insertion effect voice to channel effect */			set_ch_chorus(insertion_effect_buffer, cnt, insertion_effect_gs.send_chorus);			set_ch_delay(insertion_effect_buffer, cnt, insertion_effect_gs.send_delay);			set_ch_reverb(insertion_effect_buffer, cnt,	insertion_effect_gs.send_reverb);			if(insertion_effect_gs.send_eq_switch && channel_eq) {				set_ch_eq_gs(insertion_effect_buffer, cnt);			} else {				set_dry_signal(insertion_effect_buffer, cnt);			}		}		for(i = 0; i < MAX_CHANNELS; i++) {	/* system effects */			int32 *p;				p = vpblist[i];			if(p != buffer_pointer && p != insertion_effect_buffer) {				if (opt_drum_effect && ISDRUMCHANNEL(i)) {					for (j = 0; j < channel[i].drum_effect_num; j++) {						de = &(channel[i].drum_effect[j]);						if (de->reverb_send > 0) {							set_ch_reverb(de->buf, cnt, de->reverb_send);						}						if (de->chorus_send > 0) {							set_ch_chorus(de->buf, cnt, de->chorus_send);						}						if (de->delay_send > 0) {							set_ch_delay(de->buf, cnt, de->delay_send);						}						mix_signal(p, de->buf, cnt);					}				} else {					if(channel_chorus && channel[i].chorus_level > 0) {						set_ch_chorus(p, cnt, channel[i].chorus_level);					}					if(channel_delay && channel[i].delay_level > 0) {						set_ch_delay(p, cnt, channel[i].delay_level);					}					if(channel_reverb && channel[i].reverb_level > 0						&& current_sample - channel[i].lasttime < rev_max_delay_out) {						set_ch_reverb(p, cnt, channel[i].reverb_level);					}				}				if(channel_eq && channel[i].eq_gs) {					set_ch_eq_gs(p, cnt);				} else {					set_dry_signal(p, cnt);				}			}		}				if(channel_reverb) {			set_ch_reverb(buffer_pointer, cnt, DEFAULT_REVERB_SEND_LEVEL);		}		set_dry_signal(buffer_pointer, cnt);		/* mixing signal and applying system effects */ 		mix_dry_signal(buffer_pointer, cnt);		if(channel_eq) {do_ch_eq_gs(buffer_pointer, cnt);}		if(channel_chorus) {do_ch_chorus(buffer_pointer, cnt);}		if(channel_delay) {do_ch_delay(buffer_pointer, cnt);}		if(channel_reverb) {do_ch_reverb(buffer_pointer, cnt);}	}	current_sample += count;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/f2f704a7cf56fbd32fbf774cc38550fe963162c5/playmidi.c/buggy/timidity/playmidi.c