cent += sp->vel_to_fc * (double)(voice[v].note - sp->key_to_fc_bpo); 
cent += sp->key_to_fc * (double)(voice[v].note - sp->key_to_fc_bpo); 
void recompute_voice_filter(int v){	int ch = voice[v].channel, note = voice[v].note;	double coef = 1.0, reso = 0, cent = 0, depth_cent = 0, freq;	FilterCoefficients *fc = &(voice[v].fc);	Sample *sp = (Sample *) &voice[v].sample;	if(fc->type == 0) {return;}	coef = channel[ch].cutoff_freq_coef;	if(ISDRUMCHANNEL(ch) && channel[ch].drums[note] != NULL) {		/* NRPN Drum Instrument Filter Cutoff */		coef *= pow(1.26, (double)(channel[ch].drums[note]->drum_cutoff_freq) / 8.0f);		/* NRPN Drum Instrument Filter Resonance */		reso += (double)channel[ch].drums[note]->drum_resonance * RESONANCE_COEFF;	}	/* MIDI controllers filter cutoff control and LFO filter depth */	if(opt_channel_pressure) {		cent += get_midi_controller_filter_cutoff(&(channel[ch].mod))			+ get_midi_controller_filter_cutoff(&(channel[ch].bend))			+ get_midi_controller_filter_cutoff(&(channel[ch].caf))			+ get_midi_controller_filter_cutoff(&(channel[ch].paf))			+ get_midi_controller_filter_cutoff(&(channel[ch].cc1))			+ get_midi_controller_filter_cutoff(&(channel[ch].cc2));		depth_cent += get_midi_controller_filter_depth(&(channel[ch].mod))			+ get_midi_controller_filter_depth(&(channel[ch].bend))			+ get_midi_controller_filter_depth(&(channel[ch].caf))			+ get_midi_controller_filter_depth(&(channel[ch].paf))			+ get_midi_controller_filter_depth(&(channel[ch].cc1))			+ get_midi_controller_filter_depth(&(channel[ch].cc2));	}	if(sp->vel_to_fc) {	/* velocity to filter cutoff frequency */		if(voice[v].velocity > sp->vel_to_fc_threshold)			cent += sp->vel_to_fc * (double)(127 - voice[v].velocity) / 127.0f;		else			coef += -1200;	}	if(sp->vel_to_resonance) {	/* velocity to filter resonance */		reso += (double)voice[v].velocity * sp->vel_to_resonance / 127.0f / 10.0f;	}	if(sp->key_to_fc) {	/* filter cutoff key-follow */		cent += sp->vel_to_fc * (double)(voice[v].note - sp->key_to_fc_bpo);	}	if(opt_modulation_envelope) {		if(voice[v].sample->tremolo_to_fc + (int16)depth_cent) {			cent += ((double)voice[v].sample->tremolo_to_fc + depth_cent) * lookup_triangular(voice[v].tremolo_phase >> RATE_SHIFT);		}		if(voice[v].sample->modenv_to_fc) {			cent += (double)voice[v].sample->modenv_to_fc * voice[v].last_modenv_volume;		}	}	if(cent != 0) {coef *= pow(2.0, cent / 1200.0f);}	freq = (double)fc->orig_freq * coef;	if (freq > play_mode->rate / 2) {freq = play_mode->rate / 2;}	else if(freq < 5) {freq = 5;}	else if(freq > 20000) {freq = 20000;}	fc->freq = (int32)freq;	fc->reso_dB = fc->orig_reso_dB + channel[ch].resonance_dB + reso;	if(fc->reso_dB < 0.0f) {fc->reso_dB = 0.0f;}	else if(fc->reso_dB > 96.0f) {fc->reso_dB = 96.0f;}	if(fc->type == 1) {	/* Chamberlin filter */		if(fc->freq > play_mode->rate / 6) {fc->type = 0;}	/* turn off. */ 		if(fc->reso_dB > CHAMBERLIN_RESONANCE_MAX) {fc->reso_dB = CHAMBERLIN_RESONANCE_MAX;}	} else if(fc->type == 2) {	/* Moog VCF */		if(fc->reso_dB > fc->orig_reso_dB / 2) {			fc->gain = pow(10.0f, (fc->reso_dB - fc->orig_reso_dB / 2) / 20.0f);		}	}}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/d22f1c2d5260a4dc50adaddc324b8f0344c27553/playmidi.c/clean/timidity/playmidi.c