} 
static void update_rpn_map(int ch, int addr, int update_now){	int val, drumflag, i, note;		val = channel[ch].rpnmap[addr];	drumflag = 0;	switch (addr) {	case NRPN_ADDR_0108:	/* Vibrato Rate */		if (opt_nrpn_vibrato) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"Vibrato Rate (CH:%d VAL:%d)", ch, val - 64);			channel[ch].vibrato_ratio = gs_cnv_vib_rate(val);		}		if (update_now)			update_channel_freq(ch);		break;	case NRPN_ADDR_0109:	/* Vibrato Depth */		if (opt_nrpn_vibrato) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"Vibrato Depth (CH:%d VAL:%d)", ch, val - 64);			channel[ch].vibrato_depth = gs_cnv_vib_depth(val);		}		if (update_now)			update_channel_freq(ch);		break;	case NRPN_ADDR_010A:	/* Vibrato Delay */		if (opt_nrpn_vibrato) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"Vibrato Delay (CH:%d VAL:%d)", ch, val);			channel[ch].vibrato_delay = gs_cnv_vib_delay(val);		}		if (update_now)			update_channel_freq(ch);		break;	case NRPN_ADDR_0120:	/* Filter Cutoff Frequency */		if (opt_lpf_def) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"Filter Cutoff (CH:%d VAL:%d)", ch, val - 64);			channel[ch].param_cutoff_freq = val - 64;		}		break;	case NRPN_ADDR_0121:	/* Filter Resonance */		if (opt_lpf_def) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"Filter Resonance (CH:%d VAL:%d)", ch, val - 64);			channel[ch].param_resonance = val - 64;		}		break;	case NRPN_ADDR_0130:	/* EQ BASS */		if (opt_eq_control) {			ctl->cmsg(CMSG_INFO,VERB_NOISY,"EQ BASS (CH:%d %.2f dB)", ch, 0.19 * (double)(val - 0x40));			channel[ch].eq_xg.bass = val;			recompute_part_eq_xg(&(channel[ch].eq_xg));		}		break;	case NRPN_ADDR_0131:	/* EQ TREBLE */		if (opt_eq_control) {			ctl->cmsg(CMSG_INFO,VERB_NOISY,"EQ TREBLE (CH:%d %.2f dB)", ch, 0.19 * (double)(val - 0x40));			channel[ch].eq_xg.treble = val;			recompute_part_eq_xg(&(channel[ch].eq_xg));		}		break;	case NRPN_ADDR_0134:	/* EQ BASS frequency */		if (opt_eq_control) {			if(val < 4) {val = 4;}			else if(val > 40) {val = 40;}			ctl->cmsg(CMSG_INFO,VERB_NOISY,"EQ BASS frequency (CH:%d %d Hz)", ch, (int32)eq_freq_table_xg[val]);			channel[ch].eq_xg.bass_freq = val;			recompute_part_eq_xg(&(channel[ch].eq_xg));		}		break;	case NRPN_ADDR_0135:	/* EQ TREBLE frequency */		if (opt_eq_control) {			if(val < 28) {val = 28;}			else if(val > 58) {val = 58;}			ctl->cmsg(CMSG_INFO,VERB_NOISY,"EQ TREBLE frequency (CH:%d %d Hz)", ch, (int32)eq_freq_table_xg[val]);			channel[ch].eq_xg.treble_freq = val;			recompute_part_eq_xg(&(channel[ch].eq_xg));		}		break;	case NRPN_ADDR_0163:	/* Attack Time */		if (opt_tva_attack) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"Attack Time (CH:%d VAL:%d)", ch, val);			set_envelope_time(ch, val, 0);		}		break;	case NRPN_ADDR_0164:	/* EG Decay Time */		if (opt_tva_decay) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"EG Decay Time (CH:%d VAL:%d)", ch, val);			set_envelope_time(ch, val, 2);		}		break;	case NRPN_ADDR_0166:	/* EG Release Time */		if (opt_tva_release) {			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"EG Release Time (CH:%d VAL:%d)", ch, val);			set_envelope_time(ch, val, 3);		}		break;	case NRPN_ADDR_1400:	/* Drum Filter Cutoff (XG) */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		ctl->cmsg(CMSG_INFO, VERB_NOISY,				"Drum Instrument Filter Cutoff (CH:%d NOTE:%d VALUE:%d)",				ch, note, val);		channel[ch].drums[note]->drum_cutoff_freq = val - 64;		break;	case NRPN_ADDR_1500:	/* Drum Filter Resonance (XG) */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		ctl->cmsg(CMSG_INFO, VERB_NOISY,				"Drum Instrument Filter Resonance (CH:%d NOTE:%d VALUE:%d)",				ch, note, val);		channel[ch].drums[note]->drum_resonance = val - 64;		break;	case NRPN_ADDR_1600:	/* Drum EG Attack Time (XG) */		drumflag = 1;		if (opt_tva_attack) {			val = val & 0x7f;			note = channel[ch].lastlrpn;			if (channel[ch].drums[note] == NULL)				play_midi_setup_drums(ch, note);			val	-= 64;			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"XG Drum Attack Time (CH:%d NOTE:%d VALUE:%d)",					ch, note, val);			channel[ch].drums[note]->drum_envelope_rate[0] = val;		}		break;	case NRPN_ADDR_1700:	/* Drum EG Decay Time (XG) */		drumflag = 1;		if (opt_tva_decay) {			val = val & 0x7f;			note = channel[ch].lastlrpn;			if (channel[ch].drums[note] == NULL)				play_midi_setup_drums(ch, note);			val	-= 64;			ctl->cmsg(CMSG_INFO, VERB_NOISY,					"XG Drum Decay Time (CH:%d NOTE:%d VALUE:%d)",					ch, note, val);			channel[ch].drums[note]->drum_envelope_rate[2] = val;		}		break;	case NRPN_ADDR_1800:	/* Coarse Pitch of Drum (GS) */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		if (current_event->b == 0x01) {			channel[ch].drums[note]->play_note = val;			ctl->cmsg(CMSG_INFO, VERB_NOISY,			"Drum Instrument Play Note (CH:%d NOTE:%d VALUE:%d)",			ch, note, channel[ch].drums[note]->play_note);		} else {			channel[ch].drums[note]->coarse = val - 64;			ctl->cmsg(CMSG_INFO, VERB_NOISY,			"Drum Instrument Pitch Coarse (CH:%d NOTE:%d VALUE:%d)",			ch, note, channel[ch].drums[note]->coarse);		}		channel[ch].pitchfactor = 0;		break;	case NRPN_ADDR_1900:	/* Fine Pitch of Drum (XG) */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		channel[ch].drums[note]->fine = val - 64;		ctl->cmsg(CMSG_INFO, VERB_NOISY,				"Drum Instrument Pitch Fine (CH:%d NOTE:%d VALUE:%d)",				ch, note, channel[ch].drums[note]->fine);		channel[ch].pitchfactor = 0;		break;	case NRPN_ADDR_1A00:	/* Level of Drum */	 		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		ctl->cmsg(CMSG_INFO, VERB_NOISY,				"Drum Instrument TVA Level (CH:%d NOTE:%d VALUE:%d)",				ch, note, val);		channel[ch].drums[note]->drum_level =				calc_drum_tva_level(ch, note, val);		break;	case NRPN_ADDR_1C00:	/* Panpot of Drum */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		if(val == 0) {			val = int_rand(128);			channel[ch].drums[note]->pan_random = 1;		} else			channel[ch].drums[note]->pan_random = 0;		channel[ch].drums[note]->drum_panning = val;		if (update_now && adjust_panning_immediately				&& ! channel[ch].pan_random)			adjust_drum_panning(ch, note);		break;	case NRPN_ADDR_1D00:	/* Reverb Send Level of Drum */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		ctl->cmsg(CMSG_INFO, VERB_NOISY,				"Reverb Send Level of Drum (CH:%d NOTE:%d VALUE:%d)",				ch, note, val);		channel[ch].drums[note]->reverb_level = val;		break;	case NRPN_ADDR_1E00:	/* Chorus Send Level of Drum */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		ctl->cmsg(CMSG_INFO, VERB_NOISY,				"Chorus Send Level of Drum (CH:%d NOTE:%d VALUE:%d)",				ch, note, val);		channel[ch].drums[note]->chorus_level = val;		break;	case NRPN_ADDR_1F00:	/* Variation Send Level of Drum */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		ctl->cmsg(CMSG_INFO, VERB_NOISY,				"Delay Send Level of Drum (CH:%d NOTE:%d VALUE:%d)",				ch, note, val);		channel[ch].drums[note]->delay_level = val;		break;	case NRPN_ADDR_3000:	/* Drum EQ BASS */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		break;	case NRPN_ADDR_3100:	/* Drum EQ TREBLE */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		break;	case NRPN_ADDR_3400:	/* Drum EQ BASS frequency */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		break;	case NRPN_ADDR_3500:	/* Drum EQ TREBLE frequency */		drumflag = 1;		note = channel[ch].lastlrpn;		if (channel[ch].drums[note] == NULL)			play_midi_setup_drums(ch, note);		break;	case RPN_ADDR_0000:		/* Pitch bend sensitivity */		ctl->cmsg(CMSG_INFO, VERB_DEBUG,				"Pitch Bend Sensitivity (CH:%d VALUE:%d)", ch, val);		/* for mod2mid.c, arpeggio */		if (! IS_CURRENT_MOD_FILE && channel[ch].rpnmap[RPN_ADDR_0000] > 24)			channel[ch].rpnmap[RPN_ADDR_0000] = 24;		channel[ch].pitchfactor = 0;		break;	case RPN_ADDR_0001:		/* Master Fine Tuning */		ctl->cmsg(CMSG_INFO, VERB_DEBUG,				"Master Fine Tuning (CH:%d VALUE:%d)", ch, val);		channel[ch].pitchfactor = 0;		break;	case RPN_ADDR_0002:		/* Master Coarse Tuning */		ctl->cmsg(CMSG_INFO, VERB_DEBUG,				"Master Coarse Tuning (CH:%d VALUE:%d)", ch, val);		channel[ch].pitchfactor = 0;		break;	case RPN_ADDR_0003:		/* Tuning Program Select */		ctl->cmsg(CMSG_INFO, VERB_DEBUG,				"Tuning Program Select (CH:%d VALUE:%d)", ch, val);		for (i = 0; i < upper_voices; i++)			if (voice[i].status != VOICE_FREE) {				voice[i].temper_instant = 1;				recompute_freq(i);			}		break;	case RPN_ADDR_0004:		/* Tuning Bank Select */		ctl->cmsg(CMSG_INFO, VERB_DEBUG,				"Tuning Bank Select (CH:%d VALUE:%d)", ch, val);		for (i = 0; i < upper_voices; i++)			if (voice[i].status != VOICE_FREE) {				voice[i].temper_instant = 1;				recompute_freq(i);			}		break;	case RPN_ADDR_7F7F:		/* RPN reset */		channel[ch].rpn_7f7f_flag = 1;		break;	case RPN_ADDR_FFFF:		/* RPN initialize */		/* All reset to defaults */		channel[ch].rpn_7f7f_flag = 0;		memset(channel[ch].rpnmap, 0, sizeof(channel[ch].rpnmap));		channel[ch].lastlrpn = channel[ch].lastmrpn = 0;		channel[ch].nrpn = 0;		channel[ch].rpnmap[RPN_ADDR_0000] = 2;		channel[ch].rpnmap[RPN_ADDR_0001] = 0x40;		channel[ch].rpnmap[RPN_ADDR_0002] = 0x40;		channel[ch].pitchfactor = 0;		break;	}	drumflag = 0;	if (drumflag && midi_drumpart_change(ch, 1)) {		midi_program_change(ch, channel[ch].program);		if (update_now)			ctl_prog_event(ch);	}}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/403ba9b56064914c7c63c083a316638ac27e072e/playmidi.c/buggy/timidity/playmidi.c