/* MIDI controllers amplitude control */ if(opt_channel_pressure) { tempamp *= get_midi_controller_amp(&(channel[ch].mod)) * get_midi_controller_amp(&(channel[ch].bend)) * get_midi_controller_amp(&(channel[ch].caf)) * get_midi_controller_amp(&(channel[ch].paf)) * get_midi_controller_amp(&(channel[ch].cc1)) * get_midi_controller_amp(&(channel[ch].cc2)); recompute_voice_tremolo(v); }  /* applying panning to amplitude */ 
static void recompute_amp(int v){	FLOAT_T tempamp;	/* master_volume and sample->volume are percentages, used to scale	 *  amplitude directly, NOT perceived volume	 *	 * all other MIDI volumes are linear in perceived volume, 0-127	 * use a lookup table for the non-linear scalings	 */	if (opt_user_volume_curve) {	tempamp = master_volume *		   voice[v].sample->volume *		   user_vol_table[calc_velocity(voice[v].channel,voice[v].velocity)] *		   user_vol_table[channel[voice[v].channel].volume] *		   user_vol_table[channel[voice[v].channel].expression]; /* 21 bits */	} else if (play_system_mode == GM2_SYSTEM_MODE) {	tempamp = master_volume *		  voice[v].sample->volume *		  gm2_vol_table[calc_velocity(voice[v].channel,voice[v].velocity)] *	/* velocity: not in GM2 standard */		  gm2_vol_table[channel[voice[v].channel].volume] *		  gm2_vol_table[channel[voice[v].channel].expression]; /* 21 bits */	} else if(play_system_mode == GS_SYSTEM_MODE) {	/* use measured curve */ 	tempamp = master_volume *		   voice[v].sample->volume *		   sc_vel_table[calc_velocity(voice[v].channel,voice[v].velocity)] *		   sc_vol_table[channel[voice[v].channel].volume] *		   sc_vol_table[channel[voice[v].channel].expression]; /* 21 bits */	} else if (IS_CURRENT_MOD_FILE) {	/* use linear curve */	tempamp = master_volume *		  voice[v].sample->volume *		  calc_velocity(voice[v].channel,voice[v].velocity) *		  channel[voice[v].channel].volume *		  channel[voice[v].channel].expression; /* 21 bits */	} else {	/* use generic exponential curve */	tempamp = master_volume *		  voice[v].sample->volume *		  perceived_vol_table[calc_velocity(voice[v].channel,voice[v].velocity)] *		  perceived_vol_table[channel[voice[v].channel].volume] *		  perceived_vol_table[channel[voice[v].channel].expression]; /* 21 bits */	}	/* every digital effect increases amplitude,	 * so that it must be reduced in advance.	 */	if (! (play_mode->encoding & PE_MONO)			&& (opt_reverb_control || opt_chorus_control || opt_delay_control			|| opt_eq_control && (eq_status_gs.low_gain != 0x40			|| eq_status_gs.high_gain != 0x40) || opt_insertion_effect))		tempamp *= 1.35f * 0.55f;	else		tempamp *= 1.35f;	/* NRPN - drum instrument tva level */	if(ISDRUMCHANNEL(voice[v].channel)) {		if(channel[voice[v].channel].drums[voice[v].note] != NULL) {			tempamp *= channel[voice[v].channel].drums[voice[v].note]->drum_level;		}		tempamp *= (double)opt_drum_power * 0.01f;	}	if(!(play_mode->encoding & PE_MONO))    	{		if(voice[v].panning == 64)		{			voice[v].panned = PANNED_CENTER;			voice[v].left_amp = voice[v].right_amp = TIM_FSCALENEG(tempamp * pan_table[64], 27);		}		else if (voice[v].panning < 2)		{			voice[v].panned = PANNED_LEFT;			voice[v].left_amp = TIM_FSCALENEG(tempamp, 20);			voice[v].right_amp = 0;		}		else if(voice[v].panning == 127)		{#ifdef SMOOTH_MIXING			if(voice[v].panned == PANNED_MYSTERY) {				voice[v].old_left_mix = voice[v].old_right_mix;				voice[v].old_right_mix = 0;			}#endif			voice[v].panned = PANNED_RIGHT;			voice[v].left_amp =  TIM_FSCALENEG(tempamp, 20);			voice[v].right_amp = 0;		}		else		{#ifdef SMOOTH_MIXING			if(voice[v].panned == PANNED_RIGHT) {				voice[v].old_right_mix = voice[v].old_left_mix;				voice[v].old_left_mix = 0;			}#endif			voice[v].panned = PANNED_MYSTERY;			voice[v].left_amp = TIM_FSCALENEG(tempamp * pan_table[128 - voice[v].panning], 27);			voice[v].right_amp = TIM_FSCALENEG(tempamp * pan_table[voice[v].panning], 27);		}    	}    	else    	{		voice[v].panned = PANNED_CENTER;		voice[v].left_amp = TIM_FSCALENEG(tempamp, 21);    	}}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/048a024c89c3599d5ff158abdb8651a06b69d254/playmidi.c/buggy/timidity/playmidi.c