 vp->modenv_target = 0; new_rate = vp->modenv_volume / modenv_width;  /* Use the Release1 rate if slower than new rate */ if (vp->sample->envelope_rate[EG_GUS_RELEASE1] && vp->sample->envelope_rate[EG_GUS_RELEASE1] < new_rate) new_rate = vp->sample->envelope_rate[EG_GUS_RELEASE1];  /* Use the Sustain rate if slower than new rate */ if (vp->sample->envelope_rate[EG_GUS_SUSTAIN] && vp->sample->envelope_rate[EG_GUS_SUSTAIN] < new_rate) new_rate = vp->sample->envelope_rate[EG_GUS_SUSTAIN];  /* Avoid freezing */ if (!new_rate) new_rate = 1;  vp->modenv_increment = -new_rate; 
vp->modenv_increment = -1; vp->modenv_target = vp->modenv_volume - modenv_width; if (vp->modenv_target < 0) {vp->modenv_target = 0;} 
int recompute_modulation_envelope(int v){	int stage, ch;	double sustain_time;	int32 modenv_width;	Voice *vp = &voice[v];	if(!opt_modulation_envelope) {return 0;}	stage = vp->modenv_stage;	if (stage > EG_GUS_RELEASE3) {return 1;}	else if (stage > EG_GUS_SUSTAIN && vp->modenv_volume <= 0) {		return 1;	}	/* Routine to decay the sustain envelope	 *	 * Disabled if !min_sustain_time.	 * min_sustain_time is given in msec, and is the minimum	 *  time it will take to decay a note to zero.	 * 2000-3000 msec seem to be decent values to use.	 */	if (stage == EG_GUS_RELEASE1 && vp->sample->modes & MODES_ENVELOPE	    && vp->status & (VOICE_ON | VOICE_SUSTAINED)) {		int32 new_rate;					ch = vp->channel;		/* Don't adjust the current rate if VOICE_ON */		if (vp->status & VOICE_ON)			return 0;				if (min_sustain_time > 0 || channel[ch].loop_timeout > 0) {			if (min_sustain_time == 1)				/* The sustain stage is ignored. */				return modenv_next_stage(v);			if (channel[ch].loop_timeout > 0 &&			    channel[ch].loop_timeout * 1000 < min_sustain_time) {				/* timeout (See also "#extension timeout" line in *.cfg file */				sustain_time = channel[ch].loop_timeout * 1000;			}			else {				sustain_time = min_sustain_time;			}			/* Sustain must not be 0 or else lots of dead notes! */			if (channel[ch].sostenuto == 0 &&			    channel[ch].sustain > 0) {				sustain_time *= (double)channel[ch].sustain / 127.0f;			}			/* Calculate the width of the envelope */			modenv_width = sustain_time * play_mode->rate				       / (1000.0f * (double)control_ratio);			vp->modenv_target = 0;			new_rate = vp->modenv_volume / modenv_width;			/* Use the Release1 rate if slower than new rate */			if (vp->sample->envelope_rate[EG_GUS_RELEASE1] &&			    vp->sample->envelope_rate[EG_GUS_RELEASE1] < new_rate)			        new_rate = vp->sample->envelope_rate[EG_GUS_RELEASE1];			/* Use the Sustain rate if slower than new rate */			if (vp->sample->envelope_rate[EG_GUS_SUSTAIN] &&			    vp->sample->envelope_rate[EG_GUS_SUSTAIN] < new_rate)			        new_rate = vp->sample->envelope_rate[EG_GUS_SUSTAIN];			/* Avoid freezing */			if (!new_rate)				new_rate = 1;						vp->modenv_increment = -new_rate;		}		return 0;	}	return modenv_next_stage(v);}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/7bf19511e41caf8d6bbe7a0c03c4d1e70f94e248/mix.c/buggy/timidity/mix.c