current_keysig = opt_init_keysig; 
current_keysig = (opt_init_keysig == 8) ? 0 : opt_init_keysig; 
int play_midi_file(char *fn){    int i, j, rc;    static int last_rc = RC_NONE;    MidiEvent *event;    int32 nsamples;    /* Set current file information */    current_file_info = get_midi_file_info(fn, 1);    rc = check_apply_control();    if(RC_IS_SKIP_FILE(rc) && rc != RC_RELOAD)	return rc;    /* Reset key & speed each files */    current_keysig = opt_init_keysig;    note_key_offset = 0;    midi_time_ratio = 1.0;	for (i = 0; i < MAX_CHANNELS; i++) {		for (j = 0; j < 12; j++)			channel[i].scale_tuning[j] = 0;		channel[i].prev_scale_tuning = 0;		channel[i].temper_type = 0;	}    CLEAR_CHANNELMASK(channel_mute);	if (temper_type_mute & 1)		FILL_CHANNELMASK(channel_mute);    /* Reset restart offset */    midi_restart_time = 0;#ifdef REDUCE_VOICE_TIME_TUNING    /* Reset voice reduction stuff */    min_bad_nv = 256;    max_good_nv = 1;    ok_nv_total = 32;    ok_nv_counts = 1;    ok_nv = 32;    ok_nv_sample = 0;    old_rate = -1;    reduce_quality_flag = no_4point_interpolation;    restore_voices(0);#endif	ctl_mode_event(CTLE_METRONOME, 0, 0, 0);	ctl_mode_event(CTLE_KEYSIG, 0, current_keysig, 0);	ctl_mode_event(CTLE_TEMPER_KEYSIG, 0, 0, 0);	if (opt_force_keysig != 8) {		i = current_keysig + ((current_keysig < 8) ? 7 : -6);		j = opt_force_keysig + ((current_keysig < 8) ? 7 : 10);		while (i != j && i != j + 12) {			if (++note_key_offset > 6)				note_key_offset -= 12;			i += (i > 10) ? -5 : 7;		}	}	ctl_mode_event(CTLE_KEY_OFFSET, 0, note_key_offset, 0);	i = current_keysig + ((current_keysig < 8) ? 7 : -9), j = 0;	while (i != 7 && i != 19)		i += (i < 7) ? 5 : -7, j++;	j += note_key_offset, j -= floor(j / 12.0) * 12;	current_freq_table = j;	ctl_mode_event(CTLE_TEMPO, 0, current_play_tempo, 0);	ctl_mode_event(CTLE_TIME_RATIO, 0, 100 / midi_time_ratio + 0.5, 0);	for (i = 0; i < MAX_CHANNELS; i++) {		ctl_mode_event(CTLE_TEMPER_TYPE, 0, i, channel[i].temper_type);		ctl_mode_event(CTLE_MUTE, 0, i, temper_type_mute & 1);	}  play_reload: /* Come here to reload MIDI file */    rc = play_midi_load_file(fn, &event, &nsamples);    if(RC_IS_SKIP_FILE(rc))	goto play_end; /* skip playing */    init_mblock(&playmidi_pool);    ctl_mode_event(CTLE_PLAY_START, 0, nsamples, 0);    play_mode->acntl(PM_REQ_PLAY_START, NULL);    rc = play_midi(event, nsamples);    play_mode->acntl(PM_REQ_PLAY_END, NULL);    ctl_mode_event(CTLE_PLAY_END, 0, 0, 0);    reuse_mblock(&playmidi_pool);    for(i = 0; i < MAX_CHANNELS; i++)	memset(channel[i].drums, 0, sizeof(channel[i].drums));  play_end:    if(current_file_info->pcm_tf){    	close_file(current_file_info->pcm_tf);    	current_file_info->pcm_tf = NULL;    	free( current_file_info->pcm_filename );    	current_file_info->pcm_filename = NULL;    }        if(wrdt->opened)	wrdt->end();    if(free_instruments_afterwards)    {	int cnt;	free_instruments(0);	cnt = free_global_mblock(); /* free unused memory */	if(cnt > 0)	    ctl->cmsg(CMSG_INFO, VERB_VERBOSE, "%d memory blocks are free",		      cnt);    }    free_special_patch(-1);    if(event != NULL)	free(event);    if(rc == RC_RELOAD)	goto play_reload;    if(rc == RC_ERROR)    {	if(current_file_info->file_type == IS_OTHER_FILE)	    current_file_info->file_type = IS_ERROR_FILE;	if(last_rc == RC_REALLY_PREVIOUS)	    return RC_REALLY_PREVIOUS;    }    last_rc = rc;    return rc;}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/6e735c2764b7b157d0d160045412a4c2cdcead39/playmidi.c/clean/timidity/playmidi.c