int vel, vel_old = w32g_tracer_wnd.velocity[(int)e->v2]; 
int vel = 0, vel_old = w32g_tracer_wnd.velocity[(int)e->v2]; 
void w32_tracer_ctl_event(CtlEvent *e){	RECT rc;	int v1, v2;    switch ( e->type ) {	case CTLE_NOW_LOADING:	{		char * title;		TracerWndReset ();		TracerWndPaintAll (TRUE);		strncpy ( w32g_tracer_wnd.filename, (char *)e->v1, 1000 );		w32g_tracer_wnd.filename[1000] = '\0';		title = get_midi_title(w32g_tracer_wnd.filename);		if ( title == NULL ) title = w32g_tracer_wnd.filename;		strcpy ( w32g_tracer_wnd.titlename, "  " );		strncat ( w32g_tracer_wnd.titlename, title, 1000 );		w32g_tracer_wnd.titlename[1000] = '\0';		get_head_rc ( &rc, &w32g_tracer_wnd.rc_head_rest );		cheap_string_view_draw ( &rc, w32g_tracer_wnd.titlename, C_TEXT_FORE, C_TEXT_BACK, CSV_LEFT, TRUE );	}		break;	case CTLE_LOADING_DONE:		break;	case CTLE_PLAY_START:#if 0		{		int i;		for ( i = 0; i < TRACER_CHANNELS; i++ ) {//			tracer_ch_program_draw ( i, -1, -1, (char *)-1, -1 );			w32g_tracer_wnd.volume[i] = channel[i].volume;			w32g_tracer_wnd.expression[i] = channel[i].expression;			w32g_tracer_wnd.panning[i] = channel[i].panning;			w32g_tracer_wnd.sustain[i] = channel[i].sustain;			w32g_tracer_wnd.pitch_bend[i] = channel[i].pitchbend;			w32g_tracer_wnd.mod_wheel[i] = channel[i].mod.val;			w32g_tracer_wnd.chorus_effect[i] = channel[i].chorus_level;			w32g_tracer_wnd.reverb_effect[i] = channel[i].reverb_level;		}#endif		break;	case CTLE_PLAY_END:		break;	case CTLE_TEMPO:#if 0		{		char buff[64];		w32g_tracer_wnd.tempo = (int)e->v1;		sprintf ( buff, "%08ld", w32g_tracer_wnd.current_time);		cheap_string_view_draw ( &w32g_tracer_wnd.rc_tempo, buff, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, TRUE );		}#endif		break;	case CTLE_METRONOME:		break;	case CTLE_CURRENT_TIME:#if 0		{		int sec, min, hour;		if(midi_trace.flush_flag)			return;		if(ctl->trace_playing)			sec = (int)e->v1;		else {			sec = current_trace_samples();			if(sec < 0)				sec = (int)e->v1;			else				sec = sec / play_mode->rate;		}		min = sec / 60; sec %= 60;		hour = min / 60; min %= 60;		sprintf ( w32g_tracer_wnd.current_time, "%02d:%02d:%02d", hour, min, sec );		w32g_tracer_wnd.current_time_sec = sec;		cheap_string_view_draw ( &w32g_tracer_wnd.rc_current_time, w32g_tracer_wnd.current_time, C_TEXT_FORE, C_TEXT_BACK, CSV_CENTER, TRUE );		cheap_volume_view_draw ( &w32g_tracer_wnd.rc_maxvoices, (int)e->v2, voices, C_BAR_FORE, C_BAR_BACK, CVV_TYPE_LEFT, TRUE );	}#endif		break;	case CTLE_NOTE:		{		int vel, vel_old = w32g_tracer_wnd.velocity[(int)e->v2];		switch ( (int)e->v1 ) {		case VOICE_ON:			w32g_tracer_wnd.velocity[(int)e->v2] += (int)e->v4;			break;		case VOICE_SUSTAINED:			vel = TRACER_VOICE_SUSTAINED;			break;		case VOICE_DIE:		case VOICE_FREE:		case VOICE_OFF:			w32g_tracer_wnd.velocity[(int)e->v2] -= (int)e->v4;			vel = TRACER_VOICE_OFF;			break;		}		if ( w32g_tracer_wnd.velocity[(int)e->v2]  < 0 )			w32g_tracer_wnd.velocity[(int)e->v2]  = 0;		if ( get_ch_rc ( (int)e->v2, &rc, &w32g_tracer_wnd.rc_notes ) == 0 )			notes_view_draw ( &rc, (int)e->v3, vel, FALSE, TRUE );		w32g_tracer_wnd.notes[(int)e->v2][(int)e->v3] = vel;		if ( get_ch_rc ( (int)e->v2, &rc, &w32g_tracer_wnd.rc_velocity ) == 0 )			tracer_velocity_draw_ex ( &rc, w32g_tracer_wnd.velocity[(int)e->v2], vel_old, VEL_MAX, TRUE );		}		break;	case CTLE_MASTER_VOLUME://		ctl_master_volume((int)e->v1);#if 0		w32g_tracer_wnd.master_volume = (int)e->v1;		cheap_volume_view_draw ( &w32g_tracer_wnd.rc_master_volume, w32g_tracer_wnd.master_volume, 256, C_BAR_FORE, C_BAR_BACK, CVV_TYPE_LEFT, TRUE );#endif		break;	case CTLE_MUTE:		tracer_ch_number_draw((int) e->v1, (int) e->v2, TRUE);		break;	case CTLE_PROGRAM:		v1 = (int)e->v1; v2 = (int)e->v2;		tracer_ch_program_draw ( v1, -1, v2, (char *)e->v3, -1, TRUE );		break;	case CTLE_DRUMPART:		break;	case CTLE_VOLUME:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.volume[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_volume ) == 0 )				tracer_volume_draw ( &rc, v2, 128, TRUE );		w32g_tracer_wnd.volume[v1] = v2;		break;	case CTLE_EXPRESSION:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.expression[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_expression ) == 0 )				tracer_expression_draw ( &rc, v2, 128, TRUE );		w32g_tracer_wnd.expression[v1] = v2;		break;	case CTLE_PANNING:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.panning[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_panning ) == 0 )				tracer_pan_draw ( &rc, v2, 128, TRUE );		w32g_tracer_wnd.panning[v1] = v2;		break;	case CTLE_SUSTAIN:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.sustain[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_sustain ) == 0 )				tracer_sustain_draw ( &rc, v2, TRUE );		w32g_tracer_wnd.sustain[v1] = v2;		break;	case CTLE_PITCH_BEND:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.pitch_bend[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_pitch_bend ) == 0 )				tracer_pitch_bend_draw ( &rc, v2, 0x4000, TRUE );		w32g_tracer_wnd.pitch_bend[v1] = v2;		break;	case CTLE_MOD_WHEEL:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.mod_wheel[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_mod_wheel ) == 0 )				tracer_mod_wheel_draw ( &rc, v2, 32, TRUE );		w32g_tracer_wnd.mod_wheel[v1] = v2;		break;	case CTLE_CHORUS_EFFECT:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.chorus_effect[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_chorus_effect ) == 0 )				tracer_chorus_effect_draw ( &rc, v2, 128, TRUE );		w32g_tracer_wnd.chorus_effect[v1] = v2;		break;	case CTLE_REVERB_EFFECT:		v1 = (int)e->v1; v2 = (int)e->v2;		if ( w32g_tracer_wnd.reverb_effect[v1] != v2 )			if ( get_ch_rc ( v1, &rc, &w32g_tracer_wnd.rc_reverb_effect ) == 0 )				tracer_reverb_effect_draw ( &rc, v2, 128, TRUE );		w32g_tracer_wnd.reverb_effect[v1] = v2;		break;	case CTLE_KEY_OFFSET:		get_head_rc(&rc, &w32g_tracer_wnd.rc_temper_keysig);		tracer_temper_keysig_draw(&rc, CTL_STATUS_UPDATE, (int) e->v1, TRUE);		break;	case CTLE_TEMPER_KEYSIG:		get_head_rc(&rc, &w32g_tracer_wnd.rc_temper_keysig);		tracer_temper_keysig_draw(&rc, (int8) e->v1, CTL_STATUS_UPDATE, TRUE);		break;	case CTLE_TEMPER_TYPE:		if (! get_ch_rc((int) e->v1, &rc, &w32g_tracer_wnd.rc_temper_type))			tracer_temper_type_draw(&rc, (int) e->v1, (int8) e->v2, TRUE);		break;	case CTLE_LYRIC:		break;	case CTLE_REFRESH:		break;	case CTLE_RESET:		TracerWndReset2();#if 0		if ( w32g_tracer_wnd.play_system_mode != play_system_mode ) {#endif			get_head_rc ( &rc, &w32g_tracer_wnd.rc_gm );			tracer_gm_draw ( &rc, play_system_mode == GM_SYSTEM_MODE ? 1 : 0, TRUE );			get_head_rc ( &rc, &w32g_tracer_wnd.rc_gs );			tracer_gs_draw ( &rc, play_system_mode == GS_SYSTEM_MODE ? 1 : 0, TRUE );			get_head_rc ( &rc, &w32g_tracer_wnd.rc_xg );			tracer_xg_draw ( &rc, play_system_mode == XG_SYSTEM_MODE ? 1 : 0, TRUE );#if 0		}#endif		w32g_tracer_wnd.play_system_mode = play_system_mode;		break;	case CTLE_SPEANA:		break;	case CTLE_PAUSE:		break;	case CTLE_MAXVOICES:#if 0		w32g_tracer_wnd.maxvoices = (int)e->v1;#endif		break;	case CTLE_GSLCD:		break;    }}
4357	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4357/8f8e41d882e0a707f9845f42327647a4fda142b5/w32g_subwin3.c/buggy/interface/w32g_subwin3.c