gint set_data_source(GtkWidget *widget, gpointer data) { if (GTK_TOGGLE_BUTTON(widget)->active) { /* its pressed */ draw_stop(); input_thread_stopper(data_handle); close_datasource(data_handle); data_source = (DataSource) GPOINTER_TO_INT(data); /* start even if none previously opened (in case previous sound source was bad) */ if ((data_handle=open_datasource(data_source)) >= 0) { #ifdef USING_FFTW2 plan = fftw_create_plan(nsamp, FFTW_FORWARD, FFTW_ESTIMATE); #elif USING_FFTW3 plan = fftw_plan_r2r_1d(nsamp, raw_fft_in, raw_fft_out, FFTW_R2HC, FFTW_ESTIMATE); #endif ring_rate_changed(); /* Fix all gui controls that depend on * ring_rate (adjustments and such */ input_thread_starter(data_handle); draw_start(); } } return TRUE; }
void leave(GtkWidget *widget, gpointer *data) { draw_stop(); save_config(widget); input_thread_stopper(data_handle); close_datasource(data_handle); /* Free all buffers */ mem_dealloc(); gtk_main_quit(); }
void reinit_extace(int new_nsamp) { /* Stop drawing the display */ draw_stop(); if(data_handle != -1) /* stop if previously opened */ { input_thread_stopper(data_handle); close_datasource(data_handle); } /* Free all buffers */ mem_dealloc(); scope_begin_l = 0; scope_begin_l = 0; /* auto shift lag slightly to maintain good sync * The idea is the shift the lag slighly so that the "on-time" data * is in the MIDDLE of the window function for better eye/ear matchup */ nsamp = new_nsamp; convolve_factor = floor(nsamp/width) < 3 ? floor(nsamp/width) : 3 ; if (convolve_factor == 0) convolve_factor = 1; recalc_markers = TRUE; recalc_scale = TRUE; mem_alloc(); setup_datawindow(NULL,(WindowFunction)window_func); ring_rate_changed(); ring_pos=0; /* only start if it has been stopped above */ if(data_handle != -1 && (data_handle=open_datasource(data_source)) >= 0) { #ifdef USING_FFTW2 fftw_destroy_plan(plan); plan = fftw_create_plan(nsamp, FFTW_FORWARD, FFTW_ESTIMATE); #elif USING_FFTW3 fftw_cleanup(); plan = fftw_plan_r2r_1d(nsamp, raw_fft_in, raw_fft_out,FFTW_R2HC, FFTW_ESTIMATE); #endif input_thread_starter(data_handle); ring_rate_changed(); /* Fix all gui controls that depend on * ring_rate (adjustments and such */ draw_start(); } }
gint set_data_source() { draw_stop(); input_thread_stopper(data_handle); close_datasource(data_handle); if ((data_handle=open_datasource(data_source)) >= 0) { #ifdef USING_FFTW2 plan = fftw_create_plan(nsamp, FFTW_FORWARD, FFTW_ESTIMATE); #elif USING_FFTW3 plan = fftw_plan_r2r_1d(nsamp, raw_fft_in, raw_fft_out, FFTW_R2HC, FFTW_ESTIMATE); #endif ring_rate_changed(); /* Fix all gui controls that depend on * ring_rate (adjustments and such */ input_thread_starter(data_handle); draw_start(); } return TRUE; }