voice[i].envelope_stage=0; voice[i].envelope_volume=0; voice[i].control_counter=0;
voice[i].envelope_stage = EG_GUS_ATTACK; voice[i].envelope_volume = 0; voice[i].control_counter = 0;
static void start_note(MidiEvent *e, int i, int vid, int cnt){  int j, ch, note, pan;  ch = e->channel;  note = MIDI_EVENT_NOTE(e);  voice[i].status = VOICE_ON;  voice[i].channel = ch;  voice[i].note = note;  voice[i].velocity = e->b;  voice[i].chorus_link = i;	/* No link */  voice[i].proximate_flag = 1;  j = channel[ch].special_sample;  if(j == 0 || special_patch[j] == NULL)      voice[i].sample_offset = 0;  else  {      voice[i].sample_offset =	  special_patch[j]->sample_offset << FRACTION_BITS;      if(voice[i].sample->modes & MODES_LOOPING)      {	  if(voice[i].sample_offset > voice[i].sample->loop_end)	      voice[i].sample_offset = voice[i].sample->loop_start;      }      else if(voice[i].sample_offset > voice[i].sample->data_length)      {	  free_voice(i);	  return;      }  }  voice[i].sample_increment = 0; /* make sure it isn't negative */  voice[i].vid = vid;  voice[i].delay = voice[i].sample->envelope_delay;  voice[i].modenv_delay = voice[i].sample->modenv_delay;  voice[i].delay_counter = 0;  init_voice_tremolo(i);	/* tremolo */  init_voice_filter(i);		/* resonant lowpass filter */  init_voice_vibrato(i);	/* vibrato */  voice[i].panning = get_panning(ch, note, i);	/* pan */  init_voice_pan_delay(i);	/* panning-delay */  init_voice_portamento(i);	/* portamento or legato */  if(cnt == 0)      channel[ch].last_note_fine = voice[i].note * 256;  /* initialize modulation envelope */  if (voice[i].sample->modes & MODES_ENVELOPE)    {	  voice[i].modenv_stage = 0;      voice[i].modenv_volume = 0;      recompute_modulation_envelope(i);	  apply_modulation_envelope(i);    }  else    {	  voice[i].modenv_increment=0;	  apply_modulation_envelope(i);    }  recompute_freq(i);  recompute_voice_filter(i);  recompute_amp(i);  /* initialize volume envelope */  if (voice[i].sample->modes & MODES_ENVELOPE)    {      /* Ramp up from 0 */	  voice[i].envelope_stage=0;      voice[i].envelope_volume=0;      voice[i].control_counter=0;      recompute_envelope(i);	  apply_envelope_to_amp(i);    }  else    {      voice[i].envelope_increment=0;      apply_envelope_to_amp(i);    }  voice[i].timeout = -1;  if(!prescanning_flag)      ctl_note_event(i);}