voice[j].velocity <<= 1; 
static int reduce_voice(void){    int32 lv, v;    int i, j, lowest=-0x7FFFFFFF;    i = upper_voices;    lv = 0x7FFFFFFF;        /* Look for the decaying note with the smallest volume */    /* Protect drum decays.  Truncating them early sounds bad, especially on       snares and cymbals */    for(j = 0; j < i; j++)    {	if(voice[j].status & VOICE_FREE ||	   (voice[j].sample->note_to_use && ISDRUMCHANNEL(voice[j].channel)))	    continue;		if(voice[j].status & ~(VOICE_ON | VOICE_DIE | VOICE_SUSTAINED))	{	    /* find lowest volume */	    v = voice[j].left_mix;	    if(voice[j].panned == PANNED_MYSTERY && voice[j].right_mix > v)	    	v = voice[j].right_mix;	    if(v < lv)	    {		lv = v;		lowest = j;	    }	}    }    if(lowest != -0x7FFFFFFF)    {	/* This can still cause a click, but if we had a free voice to	   spare for ramping down this note, we wouldn't need to kill it	   in the first place... Still, this needs to be fixed. Perhaps	   we could use a reserve of voices to play dying notes only. */	cut_notes++;	free_voice(lowest);	if(!prescanning_flag)	    ctl_note_event(lowest);	return lowest;    }    /* try to remove VOICE_DIE before VOICE_ON */    lv = 0x7FFFFFFF;    lowest = -1;    for(j = 0; j < i; j++)    {      if(voice[j].status & VOICE_FREE)	    continue;      if(voice[j].status & ~(VOICE_ON | VOICE_SUSTAINED))      {	/* continue protecting drum decays */	if (voice[j].status & ~(VOICE_DIE) &&	    (voice[j].sample->note_to_use && ISDRUMCHANNEL(voice[j].channel)))		continue;	/* find lowest volume */	v = voice[j].left_mix;	if(voice[j].panned == PANNED_MYSTERY && voice[j].right_mix > v)	    v = voice[j].right_mix;	if(v < lv)	{	    lv = v;	    lowest = j;	}      }    }    if(lowest != -1)    {	cut_notes++;	free_voice(lowest);	if(!prescanning_flag)	    ctl_note_event(lowest);	return lowest;    }    /* try to remove VOICE_SUSTAINED before VOICE_ON */    lv = 0x7FFFFFFF;    lowest = -0x7FFFFFFF;    for(j = 0; j < i; j++)    {      if(voice[j].status & VOICE_FREE)	    continue;      if(voice[j].status & VOICE_SUSTAINED)      {	/* find lowest volume */	v = voice[j].left_mix;	if(voice[j].panned == PANNED_MYSTERY && voice[j].right_mix > v)	    v = voice[j].right_mix;	if(v < lv)	{	    lv = v;	    lowest = j;	}      }    }    if(lowest != -0x7FFFFFFF)    {	cut_notes++;	free_voice(lowest);	if(!prescanning_flag)	    ctl_note_event(lowest);	return lowest;    }    /* try to remove chorus before VOICE_ON */    lv = 0x7FFFFFFF;    lowest = -0x7FFFFFFF;    for(j = 0; j < i; j++)    {      if(voice[j].status & VOICE_FREE)	    continue;      if(voice[j].chorus_link < j)      {	/* find lowest volume */	v = voice[j].left_mix;	if(voice[j].panned == PANNED_MYSTERY && voice[j].right_mix > v)	    v = voice[j].right_mix;	if(v < lv)	{	    lv = v;	    lowest = j;	}      }    }    if(lowest != -0x7FFFFFFF)    {	cut_notes++;	/* hack - double volume of chorus partner, fix pan */	j = voice[lowest].chorus_link;	voice[j].velocity <<= 1;    	voice[j].panning = channel[voice[lowest].channel].panning;    	recompute_amp(j);    	apply_envelope_to_amp(j);	free_voice(lowest);	if(!prescanning_flag)	    ctl_note_event(lowest);	return lowest;    }    lost_notes++;    /* remove non-drum VOICE_ON */    lv = 0x7FFFFFFF;    lowest = -0x7FFFFFFF;    for(j = 0; j < i; j++)    {        if(voice[j].status & VOICE_FREE ||	   (voice[j].sample->note_to_use && ISDRUMCHANNEL(voice[j].channel)))	   	continue;	/* find lowest volume */	v = voice[j].left_mix;	if(voice[j].panned == PANNED_MYSTERY && voice[j].right_mix > v)	    v = voice[j].right_mix;	if(v < lv)	{	    lv = v;	    lowest = j;	}    }    if(lowest != -0x7FFFFFFF)    {	free_voice(lowest);	if(!prescanning_flag)	    ctl_note_event(lowest);	return lowest;    }    /* remove all other types of notes */    lv = 0x7FFFFFFF;    lowest = 0;    for(j = 0; j < i; j++)    {	if(voice[j].status & VOICE_FREE)	    continue;	/* find lowest volume */	v = voice[j].left_mix;	if(voice[j].panned == PANNED_MYSTERY && voice[j].right_mix > v)	    v = voice[j].right_mix;	if(v < lv)	{	    lv = v;	    lowest = j;	}    }    free_voice(lowest);    if(!prescanning_flag)	ctl_note_event(lowest);    return lowest;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/f8cd4483677cb10133859fde9c7868a36ffee9a4/playmidi.c/buggy/timidity/playmidi.c