1387
|
1 /*
|
|
2 *
|
|
3 * Author: Giacomo Lozito <james@develia.org>, (C) 2005-2006
|
|
4 *
|
|
5 * This program is free software; you can redistribute it and/or modify it
|
|
6 * under the terms of the GNU General Public License as published by the
|
|
7 * Free Software Foundation; either version 2 of the License, or (at your
|
|
8 * option) any later version.
|
|
9 *
|
|
10 * This program is distributed in the hope that it will be useful, but
|
|
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
13 * General Public License for more details.
|
|
14 *
|
|
15 * You should have received a copy of the GNU General Public License along
|
|
16 * with this program; if not, write to the Free Software Foundation, Inc.,
|
|
17 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
18 *
|
|
19 */
|
|
20
|
|
21
|
|
22 #include "i_configure-fluidsynth.h"
|
|
23 #include "backend-fluidsynth/b-fluidsynth-config.h"
|
|
24 #include "backend-fluidsynth/backend-fluidsynth-icon.xpm"
|
|
25
|
|
26
|
|
27 void i_configure_ev_toggle_default( GtkToggleButton *togglebutton , gpointer hbox )
|
|
28 {
|
|
29 if ( gtk_toggle_button_get_active( togglebutton ) )
|
|
30 gtk_widget_set_sensitive( GTK_WIDGET(hbox) , FALSE );
|
|
31 else
|
|
32 gtk_widget_set_sensitive( GTK_WIDGET(hbox) , TRUE );
|
|
33 }
|
|
34
|
|
35
|
|
36 void i_configure_ev_buffertuner_valuechanged( GtkRange *buffertuner_range )
|
|
37 {
|
|
38 gint bufsize_val, bufmarginsize_val;
|
|
39 gint i = (gint)gtk_range_get_value( GTK_RANGE(buffertuner_range) );
|
|
40 GtkWidget *bufsize_spin = g_object_get_data( G_OBJECT(buffertuner_range) , "bufsize_spin" );
|
|
41 GtkWidget *bufmarginsize_spin = g_object_get_data( G_OBJECT(buffertuner_range) , "bufmarginsize_spin" );
|
|
42
|
|
43 if ( i < 33 )
|
|
44 {
|
|
45 bufsize_val = 256 + (i * 16); /* linear growth of 16i - bufsize_val <= 768 */
|
|
46 if ( i > 16 )
|
|
47 bufmarginsize_val = 15 + ((i - 15) / 2); /* linear growth of i/2 */
|
|
48 else
|
|
49 bufmarginsize_val = 15; /* do not go below 10 even when bufsize < 512 */
|
|
50 }
|
|
51 else if ( i < 42 )
|
|
52 {
|
|
53 bufsize_val = 768 + ((i - 33) * 32); /* linear growth of 32i - bufsize_val <= 1024 */
|
|
54 bufmarginsize_val = 15 + ( (i - 16) / 2 ); /* linear growth of i/2 */
|
|
55 }
|
|
56 else
|
|
57 {
|
|
58 bufsize_val = 1024 + ( 32 << (i - 42) ); /* exponential growth - bufsize_val > 1024 */
|
|
59 bufmarginsize_val = 15 + ( (i - 16) / 2 ); /* linear growth of i/2 */
|
|
60 }
|
|
61
|
|
62 gtk_spin_button_set_value( GTK_SPIN_BUTTON(bufsize_spin) , bufsize_val );
|
|
63 gtk_spin_button_set_value( GTK_SPIN_BUTTON(bufmarginsize_spin) , bufmarginsize_val );
|
|
64 }
|
|
65
|
|
66
|
|
67 void i_configure_ev_sffile_commit( gpointer sffile_entry )
|
|
68 {
|
|
69 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
70 g_free( fsyncfg->fsyn_soundfont_file ); /* free previous */
|
|
71 fsyncfg->fsyn_soundfont_file = g_strdup( gtk_entry_get_text(GTK_ENTRY(sffile_entry)) );
|
|
72 }
|
|
73
|
|
74
|
|
75 void i_configure_ev_sfload_commit( gpointer sfload_radiobt )
|
|
76 {
|
|
77 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
78 GSList *group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(sfload_radiobt) );
|
|
79 while ( group != NULL )
|
|
80 {
|
|
81 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(group->data) ) )
|
|
82 fsyncfg->fsyn_soundfont_load = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(group->data) , "val" ));
|
|
83 group = group->next;
|
|
84 }
|
|
85 }
|
|
86
|
|
87
|
|
88 void i_configure_ev_sygain_commit( gpointer gain_spinbt )
|
|
89 {
|
|
90 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
91 if ( GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(gain_spinbt)) )
|
|
92 fsyncfg->fsyn_synth_gain = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(gain_spinbt)) * 10);
|
|
93 else
|
|
94 fsyncfg->fsyn_synth_gain = -1;
|
|
95 }
|
|
96
|
|
97
|
|
98 void i_configure_ev_sypoly_commit( gpointer poly_spinbt )
|
|
99 {
|
|
100 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
101 if ( GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(poly_spinbt)) )
|
|
102 fsyncfg->fsyn_synth_poliphony = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(poly_spinbt)));
|
|
103 else
|
|
104 fsyncfg->fsyn_synth_poliphony = -1;
|
|
105 }
|
|
106
|
|
107
|
|
108 void i_configure_ev_syreverb_commit( gpointer reverb_yes_radiobt )
|
|
109 {
|
|
110 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
111 if ( GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(reverb_yes_radiobt)) )
|
|
112 {
|
|
113 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(reverb_yes_radiobt) ) )
|
|
114 fsyncfg->fsyn_synth_reverb = 1;
|
|
115 else
|
|
116 fsyncfg->fsyn_synth_reverb = 0;
|
|
117 }
|
|
118 else
|
|
119 fsyncfg->fsyn_synth_reverb = -1;
|
|
120 }
|
|
121
|
|
122
|
|
123 void i_configure_ev_sychorus_commit( gpointer chorus_yes_radiobt )
|
|
124 {
|
|
125 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
126 if ( GTK_WIDGET_IS_SENSITIVE(GTK_WIDGET(chorus_yes_radiobt)) )
|
|
127 {
|
|
128 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(chorus_yes_radiobt) ) )
|
|
129 fsyncfg->fsyn_synth_chorus = 1;
|
|
130 else
|
|
131 fsyncfg->fsyn_synth_chorus = 0;
|
|
132 }
|
|
133 else
|
|
134 fsyncfg->fsyn_synth_chorus = -1;
|
|
135 }
|
|
136
|
|
137
|
|
138 void i_configure_ev_sysamplerate_togglecustom( GtkToggleButton *custom_radiobt , gpointer custom_entry )
|
|
139 {
|
|
140 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(custom_radiobt) ) )
|
|
141 gtk_widget_set_sensitive( GTK_WIDGET(custom_entry) , TRUE );
|
|
142 else
|
|
143 gtk_widget_set_sensitive( GTK_WIDGET(custom_entry) , FALSE );
|
|
144 }
|
|
145
|
|
146
|
|
147 void i_configure_ev_sysamplerate_commit( gpointer samplerate_custom_radiobt )
|
|
148 {
|
|
149 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
150 if ( gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(samplerate_custom_radiobt)) )
|
|
151 {
|
|
152 GtkWidget *customentry = g_object_get_data( G_OBJECT(samplerate_custom_radiobt) , "customentry" );
|
|
153 gint customvalue = strtol( gtk_entry_get_text(GTK_ENTRY(customentry)) , NULL , 10 );
|
|
154 if (( customvalue > 22050 ) && ( customvalue < 96000 ))
|
|
155 fsyncfg->fsyn_synth_samplerate = customvalue;
|
|
156 else
|
|
157 fsyncfg->fsyn_synth_samplerate = 44100;
|
|
158 }
|
|
159 else
|
|
160 {
|
|
161 GSList *group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(samplerate_custom_radiobt) );
|
|
162 while ( group != NULL )
|
|
163 {
|
|
164 if ( gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(group->data) ) )
|
|
165 fsyncfg->fsyn_synth_samplerate = GPOINTER_TO_INT(g_object_get_data( G_OBJECT(group->data) , "val" ));
|
|
166 group = group->next;
|
|
167 }
|
|
168 }
|
|
169 }
|
|
170
|
|
171
|
|
172 void i_configure_ev_bufsize_commit( gpointer bufsize_spinbt )
|
|
173 {
|
|
174 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
175 fsyncfg->fsyn_buffer_size = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(bufsize_spinbt)));
|
|
176 }
|
|
177
|
|
178
|
|
179 void i_configure_ev_bufmarginsize_commit( gpointer marginsize_spinbt )
|
|
180 {
|
|
181 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
182 fsyncfg->fsyn_buffer_margin = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(marginsize_spinbt)));
|
|
183 }
|
|
184
|
|
185
|
|
186 void i_configure_ev_bufmargininc_commit( gpointer margininc_spinbt )
|
|
187 {
|
|
188 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
189 fsyncfg->fsyn_buffer_increment = (gint)(gtk_spin_button_get_value(GTK_SPIN_BUTTON(margininc_spinbt)));
|
|
190 }
|
|
191
|
|
192
|
|
193 void i_configure_buffertuner_setvalue( GtkWidget * buftuner_hscale , gint bufsize )
|
|
194 {
|
|
195 gint scale_value = 0;
|
|
196 if ( bufsize <= 768 )
|
|
197 {
|
|
198 scale_value = ( bufsize - 256 ) / 16;
|
|
199 }
|
|
200 else if ( bufsize <= 1024 )
|
|
201 {
|
|
202 scale_value = ( bufsize + 288 ) / 32;
|
|
203 }
|
|
204 else
|
|
205 {
|
|
206 gint tcount = 0, tval = bufsize - 1024;
|
|
207 tval = tval >> 1;
|
|
208 while ( tval > 0 )
|
|
209 {
|
|
210 tval = tval >> 1;
|
|
211 tcount++;
|
|
212 }
|
|
213 scale_value = 37 + tcount;
|
|
214 }
|
|
215 if ( scale_value < 0 )
|
|
216 scale_value = 0;
|
|
217 else if ( scale_value > 53 )
|
|
218 scale_value = 53;
|
|
219 gtk_range_set_value( GTK_RANGE(buftuner_hscale) , scale_value );
|
|
220 }
|
|
221
|
|
222
|
|
223 void i_configure_ev_buffertuner_default( gpointer buffertuner_hscale )
|
|
224 {
|
|
225 GtkWidget *bufsize_spin = g_object_get_data( G_OBJECT(buffertuner_hscale) , "bufsize_spin" );
|
|
226 GtkWidget *bufmarginsize_spin = g_object_get_data( G_OBJECT(buffertuner_hscale) , "bufmarginsize_spin" );
|
|
227 GtkWidget *bufmargininc_spin = g_object_get_data( G_OBJECT(buffertuner_hscale) , "bufmargininc_spin" );
|
|
228 i_configure_buffertuner_setvalue( GTK_WIDGET(buffertuner_hscale) , 512 );
|
|
229 gtk_spin_button_set_value( GTK_SPIN_BUTTON(bufsize_spin) , 512 );
|
|
230 gtk_spin_button_set_value( GTK_SPIN_BUTTON(bufmarginsize_spin) , 15 );
|
|
231 gtk_spin_button_set_value( GTK_SPIN_BUTTON(bufmargininc_spin) , 18 );
|
|
232 }
|
|
233
|
|
234
|
|
235 void i_configure_gui_tab_fsyn( GtkWidget * fsyn_page_alignment ,
|
|
236 gpointer backend_list_p ,
|
|
237 gpointer commit_button )
|
|
238 {
|
|
239 GtkWidget *fsyn_page_vbox;
|
|
240 GtkWidget *title_widget;
|
|
241 GtkWidget *content_vbox; /* this vbox will contain the various frames for config sections */
|
|
242 GSList * backend_list = backend_list_p;
|
|
243 gboolean fsyn_module_ok = FALSE;
|
|
244 gchar * fsyn_module_pathfilename;
|
|
245
|
|
246 fsyn_page_vbox = gtk_vbox_new( FALSE , 0 );
|
|
247
|
|
248 title_widget = i_configure_gui_draw_title( _("FLUIDSYNTH BACKEND CONFIGURATION") );
|
|
249 gtk_box_pack_start( GTK_BOX(fsyn_page_vbox) , title_widget , FALSE , FALSE , 2 );
|
|
250
|
|
251 content_vbox = gtk_vbox_new( FALSE , 2 );
|
|
252
|
|
253 /* check if the FluidSynth module is available */
|
|
254 while ( backend_list != NULL )
|
|
255 {
|
|
256 amidiplug_sequencer_backend_name_t * mn = backend_list->data;
|
|
257 if ( !strcmp( mn->name , "fluidsynth" ) )
|
|
258 {
|
|
259 fsyn_module_ok = TRUE;
|
|
260 fsyn_module_pathfilename = mn->filename;
|
|
261 break;
|
|
262 }
|
|
263 backend_list = backend_list->next;
|
|
264 }
|
|
265
|
|
266 if ( fsyn_module_ok )
|
|
267 {
|
|
268 GtkWidget *soundfont_frame, *soundfont_vbox;
|
|
269 GtkWidget *soundfont_file_label, *soundfont_file_entry, *soundfont_file_bbutton, *soundfont_file_hbox;
|
|
270 GtkWidget *soundfont_load_hsep, *soundfont_load_vbox, *soundfont_load_option[2];
|
|
271 GtkWidget *synth_frame, *synth_hbox, *synth_leftcol_vbox, *synth_rightcol_vbox;
|
|
272 GtkWidget *synth_samplerate_frame, *synth_samplerate_vbox, *synth_samplerate_option[4];
|
|
273 GtkWidget *synth_samplerate_optionhbox, *synth_samplerate_optionentry, *synth_samplerate_optionlabel;
|
|
274 GtkWidget *synth_gain_frame, *synth_gain_hbox, *synth_gain_value_hbox;
|
|
275 GtkWidget *synth_gain_value_label, *synth_gain_value_spin, *synth_gain_defcheckbt;
|
|
276 GtkWidget *synth_poly_frame, *synth_poly_hbox, *synth_poly_value_hbox;
|
|
277 GtkWidget *synth_poly_value_label, *synth_poly_value_spin, *synth_poly_defcheckbt;
|
|
278 GtkWidget *synth_reverb_frame, *synth_reverb_hbox, *synth_reverb_value_hbox;
|
|
279 GtkWidget *synth_reverb_value_option[2], *synth_reverb_defcheckbt;
|
|
280 GtkWidget *synth_chorus_frame, *synth_chorus_hbox, *synth_chorus_value_hbox;
|
|
281 GtkWidget *synth_chorus_value_option[2], *synth_chorus_defcheckbt;
|
|
282 GtkWidget *buffer_frame, *buffer_table , *buffer_vsep[4];
|
|
283 GtkWidget *buffer_tuner_label, *buffer_tuner_hscale;
|
|
284 GtkWidget *buffer_tuner_defbt, *buffer_tuner_defbt_label;
|
|
285 GtkWidget *buffer_bufsize_label, *buffer_bufsize_spin;
|
|
286 GtkWidget *buffer_marginsize_label, *buffer_marginsize_spin;
|
|
287 GtkWidget *buffer_margininc_label, *buffer_margininc_spin;
|
|
288 GtkTooltips *tips;
|
|
289
|
|
290 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
291
|
|
292 tips = gtk_tooltips_new();
|
|
293 g_object_set_data_full( G_OBJECT(fsyn_page_alignment) , "tt" , tips , g_object_unref );
|
|
294
|
|
295 /* soundfont settings */
|
|
296 soundfont_frame = gtk_frame_new( _("SoundFont settings") );
|
|
297 soundfont_vbox = gtk_vbox_new( FALSE , 2 );
|
|
298 gtk_container_set_border_width( GTK_CONTAINER(soundfont_vbox), 4 );
|
|
299 gtk_container_add( GTK_CONTAINER(soundfont_frame) , soundfont_vbox );
|
|
300 /* soundfont settings - file */
|
|
301 soundfont_file_hbox = gtk_hbox_new( FALSE , 2 );
|
|
302 soundfont_file_label = gtk_label_new( _("SoundFont filename:") );
|
|
303 soundfont_file_entry = gtk_entry_new();
|
|
304 g_object_set_data( G_OBJECT(soundfont_file_entry) , "fc-act" ,
|
|
305 GINT_TO_POINTER(GTK_FILE_CHOOSER_ACTION_OPEN) );
|
|
306 gtk_entry_set_text( GTK_ENTRY(soundfont_file_entry) , fsyncfg->fsyn_soundfont_file );
|
|
307 soundfont_file_bbutton = gtk_button_new_with_label( _("browse") );
|
|
308 g_signal_connect_swapped( G_OBJECT(soundfont_file_bbutton) , "clicked" ,
|
|
309 G_CALLBACK(i_configure_ev_browse_for_entry) , soundfont_file_entry );
|
|
310 gtk_box_pack_start( GTK_BOX(soundfont_file_hbox) , soundfont_file_label , FALSE , FALSE , 0 );
|
|
311 gtk_box_pack_start( GTK_BOX(soundfont_file_hbox) , soundfont_file_entry , TRUE , TRUE , 0 );
|
|
312 gtk_box_pack_start( GTK_BOX(soundfont_file_hbox) , soundfont_file_bbutton , FALSE , FALSE , 0 );
|
|
313 gtk_box_pack_start( GTK_BOX(soundfont_vbox) , soundfont_file_hbox , FALSE , FALSE , 0 );
|
|
314 /* soundfont settings - load */
|
|
315 soundfont_load_hsep = gtk_hseparator_new();
|
|
316 soundfont_load_vbox = gtk_vbox_new( FALSE , 0 );
|
|
317 soundfont_load_option[0] = gtk_radio_button_new_with_label( NULL ,
|
|
318 _("Load SoundFont on player start") );
|
|
319 g_object_set_data( G_OBJECT(soundfont_load_option[0]) , "val" , GINT_TO_POINTER(0) );
|
|
320 soundfont_load_option[1] = gtk_radio_button_new_with_label_from_widget(
|
|
321 GTK_RADIO_BUTTON(soundfont_load_option[0]) ,
|
|
322 _("Load SoundFont on first midifile play") );
|
|
323 g_object_set_data( G_OBJECT(soundfont_load_option[1]) , "val" , GINT_TO_POINTER(1) );
|
|
324 if ( fsyncfg->fsyn_soundfont_load == 0 )
|
|
325 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(soundfont_load_option[0]) , TRUE );
|
|
326 else
|
|
327 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(soundfont_load_option[1]) , TRUE );
|
|
328 gtk_box_pack_start( GTK_BOX(soundfont_load_vbox) , soundfont_load_option[0] , FALSE , FALSE , 0 );
|
|
329 gtk_box_pack_start( GTK_BOX(soundfont_load_vbox) , soundfont_load_option[1] , FALSE , FALSE , 0 );
|
|
330 gtk_box_pack_start( GTK_BOX(soundfont_vbox) , soundfont_load_hsep , FALSE , FALSE , 3 );
|
|
331 gtk_box_pack_start( GTK_BOX(soundfont_vbox) , soundfont_load_vbox , FALSE , FALSE , 0 );
|
|
332
|
|
333 gtk_box_pack_start( GTK_BOX(content_vbox) , soundfont_frame , FALSE , FALSE , 0 );
|
|
334
|
|
335 /* synth settings */
|
|
336 synth_frame = gtk_frame_new( _("Synthesizer settings") );
|
|
337 synth_hbox = gtk_hbox_new( FALSE , 4 );
|
|
338 gtk_container_set_border_width( GTK_CONTAINER(synth_hbox), 4 );
|
|
339 gtk_container_add( GTK_CONTAINER(synth_frame) , synth_hbox );
|
|
340 synth_leftcol_vbox = gtk_vbox_new( TRUE , 0 );
|
|
341 synth_rightcol_vbox = gtk_vbox_new( FALSE , 0 );
|
|
342 gtk_box_pack_start( GTK_BOX(synth_hbox) , synth_leftcol_vbox , TRUE , TRUE , 0 );
|
|
343 gtk_box_pack_start( GTK_BOX(synth_hbox) , synth_rightcol_vbox , FALSE , FALSE , 0 );
|
|
344 /* synth settings - gain */
|
|
345 synth_gain_frame = gtk_frame_new( _("gain") );
|
|
346 gtk_frame_set_label_align( GTK_FRAME(synth_gain_frame) , 0.5 , 0.5 );
|
|
347 gtk_box_pack_start( GTK_BOX(synth_leftcol_vbox) , synth_gain_frame , TRUE , TRUE , 0 );
|
|
348 synth_gain_hbox = gtk_hbox_new( TRUE , 2 );
|
|
349 gtk_container_set_border_width( GTK_CONTAINER(synth_gain_hbox), 2 );
|
|
350 gtk_container_add( GTK_CONTAINER(synth_gain_frame) , synth_gain_hbox );
|
|
351 synth_gain_defcheckbt = gtk_check_button_new_with_label( _("use default") );
|
|
352 gtk_box_pack_start( GTK_BOX(synth_gain_hbox) , synth_gain_defcheckbt , FALSE , FALSE , 0 );
|
|
353 synth_gain_value_hbox = gtk_hbox_new( FALSE , 4 );
|
|
354 synth_gain_value_label = gtk_label_new( _("value:") );
|
|
355 synth_gain_value_spin = gtk_spin_button_new_with_range( 0.0 , 10.0 , 0.1 );
|
|
356 gtk_spin_button_set_value( GTK_SPIN_BUTTON(synth_gain_value_spin) , 0.2 );
|
|
357 g_signal_connect( G_OBJECT(synth_gain_defcheckbt) , "toggled" ,
|
|
358 G_CALLBACK(i_configure_ev_toggle_default) , synth_gain_value_hbox );
|
|
359 if ( fsyncfg->fsyn_synth_gain < 0 )
|
|
360 {
|
|
361 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_gain_defcheckbt) , TRUE );
|
|
362 }
|
|
363 else
|
|
364 {
|
|
365 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_gain_defcheckbt) , FALSE );
|
|
366 gtk_spin_button_set_value( GTK_SPIN_BUTTON(synth_gain_value_spin) ,
|
|
367 (gdouble)fsyncfg->fsyn_synth_gain / 10 );
|
|
368 }
|
|
369 gtk_box_pack_start( GTK_BOX(synth_gain_hbox) , synth_gain_value_hbox , FALSE , FALSE , 0 );
|
|
370 gtk_box_pack_start( GTK_BOX(synth_gain_value_hbox) , synth_gain_value_label , FALSE , FALSE , 0 );
|
|
371 gtk_box_pack_start( GTK_BOX(synth_gain_value_hbox) , synth_gain_value_spin , FALSE , FALSE , 0 );
|
|
372 /* synth settings - poliphony */
|
|
373 synth_poly_frame = gtk_frame_new( _("poliphony") );
|
|
374 gtk_frame_set_label_align( GTK_FRAME(synth_poly_frame) , 0.5 , 0.5 );
|
|
375 gtk_box_pack_start( GTK_BOX(synth_leftcol_vbox) , synth_poly_frame , TRUE , TRUE , 0 );
|
|
376 synth_poly_hbox = gtk_hbox_new( TRUE , 2 );
|
|
377 gtk_container_set_border_width( GTK_CONTAINER(synth_poly_hbox), 2 );
|
|
378 gtk_container_add( GTK_CONTAINER(synth_poly_frame) , synth_poly_hbox );
|
|
379 synth_poly_defcheckbt = gtk_check_button_new_with_label( _("use default") );
|
|
380 gtk_box_pack_start( GTK_BOX(synth_poly_hbox) , synth_poly_defcheckbt , FALSE , FALSE , 0 );
|
|
381 synth_poly_value_hbox = gtk_hbox_new( FALSE , 4 );
|
|
382 synth_poly_value_label = gtk_label_new( _("value:") );
|
|
383 synth_poly_value_spin = gtk_spin_button_new_with_range( 16 , 4096 , 1 );
|
|
384 gtk_spin_button_set_value( GTK_SPIN_BUTTON(synth_poly_value_spin) , 256 );
|
|
385 g_signal_connect( G_OBJECT(synth_poly_defcheckbt) , "toggled" ,
|
|
386 G_CALLBACK(i_configure_ev_toggle_default) , synth_poly_value_hbox );
|
|
387 if ( fsyncfg->fsyn_synth_poliphony < 0 )
|
|
388 {
|
|
389 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_poly_defcheckbt) , TRUE );
|
|
390 }
|
|
391 else
|
|
392 {
|
|
393 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_poly_defcheckbt) , FALSE );
|
|
394 gtk_spin_button_set_value( GTK_SPIN_BUTTON(synth_poly_value_spin) ,
|
|
395 (gdouble)fsyncfg->fsyn_synth_poliphony );
|
|
396 }
|
|
397 gtk_box_pack_start( GTK_BOX(synth_poly_hbox) , synth_poly_value_hbox , FALSE , FALSE , 0 );
|
|
398 gtk_box_pack_start( GTK_BOX(synth_poly_value_hbox) , synth_poly_value_label , FALSE , FALSE , 0 );
|
|
399 gtk_box_pack_start( GTK_BOX(synth_poly_value_hbox) , synth_poly_value_spin , FALSE , FALSE , 0 );
|
|
400 /* synth settings - reverb */
|
|
401 synth_reverb_frame = gtk_frame_new( _("reverb") );
|
|
402 gtk_frame_set_label_align( GTK_FRAME(synth_reverb_frame) , 0.5 , 0.5 );
|
|
403 gtk_box_pack_start( GTK_BOX(synth_leftcol_vbox) , synth_reverb_frame , TRUE , TRUE , 0 );
|
|
404 synth_reverb_hbox = gtk_hbox_new( TRUE , 2 );
|
|
405 gtk_container_set_border_width( GTK_CONTAINER(synth_reverb_hbox), 2 );
|
|
406 gtk_container_add( GTK_CONTAINER(synth_reverb_frame) , synth_reverb_hbox );
|
|
407 synth_reverb_defcheckbt = gtk_check_button_new_with_label( _("use default") );
|
|
408 gtk_box_pack_start( GTK_BOX(synth_reverb_hbox) , synth_reverb_defcheckbt , FALSE , FALSE , 0 );
|
|
409 synth_reverb_value_hbox = gtk_hbox_new( TRUE , 4 );
|
|
410 synth_reverb_value_option[0] = gtk_radio_button_new_with_label( NULL , _("yes") );
|
|
411 synth_reverb_value_option[1] = gtk_radio_button_new_with_label_from_widget(
|
|
412 GTK_RADIO_BUTTON(synth_reverb_value_option[0]) , _("no") );
|
|
413 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_reverb_value_option[0]) , TRUE );
|
|
414 g_signal_connect( G_OBJECT(synth_reverb_defcheckbt) , "toggled" ,
|
|
415 G_CALLBACK(i_configure_ev_toggle_default) , synth_reverb_value_hbox );
|
|
416 if ( fsyncfg->fsyn_synth_reverb < 0 )
|
|
417 {
|
|
418 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_reverb_defcheckbt) , TRUE );
|
|
419 }
|
|
420 else
|
|
421 {
|
|
422 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_reverb_defcheckbt) , FALSE );
|
|
423 if ( fsyncfg->fsyn_synth_reverb == 0 )
|
|
424 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_reverb_value_option[1]) , TRUE );
|
|
425 else
|
|
426 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_reverb_value_option[0]) , TRUE );
|
|
427 }
|
|
428 gtk_box_pack_start( GTK_BOX(synth_reverb_hbox) , synth_reverb_value_hbox , FALSE , FALSE , 0 );
|
|
429 gtk_box_pack_start( GTK_BOX(synth_reverb_value_hbox) , synth_reverb_value_option[0] , FALSE , FALSE , 0 );
|
|
430 gtk_box_pack_start( GTK_BOX(synth_reverb_value_hbox) , synth_reverb_value_option[1] , FALSE , FALSE , 0 );
|
|
431 /* synth settings - chorus */
|
|
432 synth_chorus_frame = gtk_frame_new( _("chorus") );
|
|
433 gtk_frame_set_label_align( GTK_FRAME(synth_chorus_frame) , 0.5 , 0.5 );
|
|
434 gtk_box_pack_start( GTK_BOX(synth_leftcol_vbox) , synth_chorus_frame , TRUE , TRUE , 0 );
|
|
435 synth_chorus_hbox = gtk_hbox_new( TRUE , 2 );
|
|
436 gtk_container_set_border_width( GTK_CONTAINER(synth_chorus_hbox), 2 );
|
|
437 gtk_container_add( GTK_CONTAINER(synth_chorus_frame) , synth_chorus_hbox );
|
|
438 synth_chorus_defcheckbt = gtk_check_button_new_with_label( _("use default") );
|
|
439 gtk_box_pack_start( GTK_BOX(synth_chorus_hbox) , synth_chorus_defcheckbt , FALSE , FALSE , 0 );
|
|
440 synth_chorus_value_hbox = gtk_hbox_new( TRUE , 4 );
|
|
441 synth_chorus_value_option[0] = gtk_radio_button_new_with_label( NULL , _("yes") );
|
|
442 synth_chorus_value_option[1] = gtk_radio_button_new_with_label_from_widget(
|
|
443 GTK_RADIO_BUTTON(synth_chorus_value_option[0]) , _("no") );
|
|
444 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_chorus_value_option[0]) , TRUE );
|
|
445 g_signal_connect( G_OBJECT(synth_chorus_defcheckbt) , "toggled" ,
|
|
446 G_CALLBACK(i_configure_ev_toggle_default) , synth_chorus_value_hbox );
|
|
447 if ( fsyncfg->fsyn_synth_chorus < 0 )
|
|
448 {
|
|
449 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_chorus_defcheckbt) , TRUE );
|
|
450 }
|
|
451 else
|
|
452 {
|
|
453 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_chorus_defcheckbt) , FALSE );
|
|
454 if ( fsyncfg->fsyn_synth_chorus == 0 )
|
|
455 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_chorus_value_option[1]) , TRUE );
|
|
456 else
|
|
457 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_chorus_value_option[0]) , TRUE );
|
|
458 }
|
|
459 gtk_box_pack_start( GTK_BOX(synth_chorus_hbox) , synth_chorus_value_hbox , FALSE , FALSE , 0 );
|
|
460 gtk_box_pack_start( GTK_BOX(synth_chorus_value_hbox) , synth_chorus_value_option[0] , FALSE , FALSE , 0 );
|
|
461 gtk_box_pack_start( GTK_BOX(synth_chorus_value_hbox) , synth_chorus_value_option[1] , FALSE , FALSE , 0 );
|
|
462 /* synth settings - samplerate */
|
|
463 synth_samplerate_frame = gtk_frame_new( _("sample rate") );
|
|
464 gtk_frame_set_label_align( GTK_FRAME(synth_samplerate_frame) , 0.5 , 0.5 );
|
|
465 synth_samplerate_vbox = gtk_vbox_new( TRUE , 0 );
|
|
466 gtk_container_set_border_width( GTK_CONTAINER(synth_samplerate_vbox), 6 );
|
|
467 gtk_container_add( GTK_CONTAINER(synth_samplerate_frame) , synth_samplerate_vbox );
|
|
468 gtk_box_pack_start( GTK_BOX(synth_rightcol_vbox) , synth_samplerate_frame , FALSE , FALSE , 0 );
|
|
469 synth_samplerate_option[0] = gtk_radio_button_new_with_label( NULL , "22050 Hz " );
|
|
470 g_object_set_data( G_OBJECT(synth_samplerate_option[0]) , "val" , GINT_TO_POINTER(22050) );
|
|
471 synth_samplerate_option[1] = gtk_radio_button_new_with_label_from_widget(
|
|
472 GTK_RADIO_BUTTON(synth_samplerate_option[0]) , "44100 Hz " );
|
|
473 g_object_set_data( G_OBJECT(synth_samplerate_option[1]) , "val" , GINT_TO_POINTER(44100) );
|
|
474 synth_samplerate_option[2] = gtk_radio_button_new_with_label_from_widget(
|
|
475 GTK_RADIO_BUTTON(synth_samplerate_option[0]) , "96000 Hz " );
|
|
476 g_object_set_data( G_OBJECT(synth_samplerate_option[2]) , "val" , GINT_TO_POINTER(96000) );
|
|
477 synth_samplerate_option[3] = gtk_radio_button_new_with_label_from_widget(
|
|
478 GTK_RADIO_BUTTON(synth_samplerate_option[0]) , _("custom ") );
|
|
479 synth_samplerate_optionhbox = gtk_hbox_new( FALSE , 4 );
|
|
480 synth_samplerate_optionentry = gtk_entry_new();
|
|
481 gtk_widget_set_sensitive( GTK_WIDGET(synth_samplerate_optionentry) , FALSE );
|
|
482 gtk_entry_set_width_chars( GTK_ENTRY(synth_samplerate_optionentry) , 8 );
|
|
483 gtk_entry_set_max_length( GTK_ENTRY(synth_samplerate_optionentry) , 5 );
|
|
484 g_object_set_data( G_OBJECT(synth_samplerate_option[3]) , "customentry" , synth_samplerate_optionentry );
|
|
485 g_signal_connect( G_OBJECT(synth_samplerate_option[3]) , "toggled" ,
|
|
486 G_CALLBACK(i_configure_ev_sysamplerate_togglecustom) , synth_samplerate_optionentry );
|
|
487 synth_samplerate_optionlabel = gtk_label_new( "Hz " );
|
|
488 gtk_box_pack_start( GTK_BOX(synth_samplerate_optionhbox) , synth_samplerate_optionentry , TRUE , TRUE , 0 );
|
|
489 gtk_box_pack_start( GTK_BOX(synth_samplerate_optionhbox) , synth_samplerate_optionlabel , FALSE , FALSE , 0 );
|
|
490 switch ( fsyncfg->fsyn_synth_samplerate )
|
|
491 {
|
|
492 case 22050:
|
|
493 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_samplerate_option[0]) , TRUE );
|
|
494 break;
|
|
495 case 44100:
|
|
496 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_samplerate_option[1]) , TRUE );
|
|
497 break;
|
|
498 case 96000:
|
|
499 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_samplerate_option[2]) , TRUE );
|
|
500 break;
|
|
501 default:
|
|
502 if (( fsyncfg->fsyn_synth_samplerate > 22050 ) && ( fsyncfg->fsyn_synth_samplerate < 96000 ))
|
|
503 {
|
|
504 gchar *samplerate_value = g_strdup_printf( "%i" , fsyncfg->fsyn_synth_samplerate );
|
|
505 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_samplerate_option[3]) , TRUE );
|
|
506 gtk_entry_set_text( GTK_ENTRY(synth_samplerate_optionentry) , samplerate_value );
|
|
507 g_free( samplerate_value );
|
|
508 }
|
|
509 else
|
|
510 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(synth_samplerate_option[1]) , TRUE );
|
|
511 }
|
|
512 gtk_box_pack_start( GTK_BOX(synth_samplerate_vbox) , synth_samplerate_option[0] , FALSE , FALSE , 0 );
|
|
513 gtk_box_pack_start( GTK_BOX(synth_samplerate_vbox) , synth_samplerate_option[1] , FALSE , FALSE , 0 );
|
|
514 gtk_box_pack_start( GTK_BOX(synth_samplerate_vbox) , synth_samplerate_option[2] , FALSE , FALSE , 0 );
|
|
515 gtk_box_pack_start( GTK_BOX(synth_samplerate_vbox) , synth_samplerate_option[3] , FALSE , FALSE , 0 );
|
|
516 gtk_box_pack_start( GTK_BOX(synth_samplerate_vbox) , synth_samplerate_optionhbox , FALSE , FALSE , 0 );
|
|
517
|
|
518 gtk_box_pack_start( GTK_BOX(content_vbox) , synth_frame , TRUE , TRUE , 0 );
|
|
519
|
|
520 /* buffer settings */
|
|
521 buffer_frame = gtk_frame_new( _("Buffer settings") );
|
|
522 buffer_table = gtk_table_new( 2 , 9 , FALSE );
|
|
523 gtk_table_set_col_spacings( GTK_TABLE(buffer_table) , 2 );
|
|
524 gtk_container_set_border_width( GTK_CONTAINER(buffer_table), 4 );
|
|
525 gtk_container_add( GTK_CONTAINER(buffer_frame) , buffer_table );
|
|
526 /* buffer settings - slider */
|
|
527 buffer_tuner_defbt = gtk_button_new();
|
|
528 buffer_tuner_defbt_label = gtk_label_new( "" );
|
|
529 gtk_label_set_markup( GTK_LABEL(buffer_tuner_defbt_label) ,
|
|
530 _("<span size=\"smaller\">def</span>") );
|
|
531 gtk_container_add( GTK_CONTAINER(buffer_tuner_defbt) , buffer_tuner_defbt_label );
|
|
532 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_tuner_defbt , 0 , 1 , 0 , 2 ,
|
|
533 0 , GTK_FILL , 2 , 0 );
|
|
534 buffer_vsep[0] = gtk_vseparator_new();
|
|
535 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_vsep[0] , 1 , 2 , 0 , 2 ,
|
|
536 0 , GTK_FILL , 0 , 0 );
|
|
537 buffer_tuner_label = gtk_label_new( "" );
|
|
538 gtk_label_set_markup( GTK_LABEL(buffer_tuner_label) ,
|
|
539 _("<span size=\"smaller\">handy buffer tuner</span>") );
|
|
540 buffer_tuner_hscale = gtk_hscale_new_with_range( 0 , 53 , 1 );
|
|
541 gtk_scale_set_draw_value( GTK_SCALE(buffer_tuner_hscale) , FALSE );
|
|
542 i_configure_buffertuner_setvalue( buffer_tuner_hscale , fsyncfg->fsyn_buffer_size );
|
|
543 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_tuner_label , 2 , 3 , 0 , 1 ,
|
|
544 GTK_EXPAND | GTK_FILL , GTK_EXPAND | GTK_FILL , 0 , 0 );
|
|
545 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_tuner_hscale , 2 , 3 , 1 , 2 ,
|
|
546 GTK_EXPAND | GTK_FILL , GTK_EXPAND | GTK_FILL , 0 , 0 );
|
|
547 buffer_vsep[1] = gtk_vseparator_new();
|
|
548 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_vsep[1] , 3 , 4 , 0 , 2 ,
|
|
549 0 , GTK_FILL , 0 , 0 );
|
|
550 /* buffer settings - size */
|
|
551 buffer_bufsize_label = gtk_label_new( "" );
|
|
552 gtk_label_set_markup( GTK_LABEL(buffer_bufsize_label) ,
|
|
553 _("<span size=\"smaller\">size</span>") );
|
|
554 buffer_bufsize_spin = gtk_spin_button_new_with_range( 100 , 99999 , 20 );
|
|
555 gtk_spin_button_set_value( GTK_SPIN_BUTTON(buffer_bufsize_spin) ,
|
|
556 (gdouble)fsyncfg->fsyn_buffer_size );
|
|
557 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_bufsize_label , 4 , 5 , 0 , 1 ,
|
|
558 GTK_FILL , 0 , 1 , 1 );
|
|
559 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_bufsize_spin , 4 , 5 , 1 , 2 ,
|
|
560 0 , 0 , 1 , 1 );
|
|
561 buffer_vsep[2] = gtk_vseparator_new();
|
|
562 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_vsep[2] , 5 , 6 , 0 , 2 ,
|
|
563 0 , GTK_FILL , 0 , 0 );
|
|
564 /* buffer settings - margin */
|
|
565 buffer_marginsize_label = gtk_label_new( "" );
|
|
566 gtk_label_set_markup( GTK_LABEL(buffer_marginsize_label) ,
|
|
567 _("<span size=\"smaller\">margin</span>") );
|
|
568 buffer_marginsize_spin = gtk_spin_button_new_with_range( 0 , 100 , 1 );
|
|
569 gtk_spin_button_set_value( GTK_SPIN_BUTTON(buffer_marginsize_spin) ,
|
|
570 (gdouble)fsyncfg->fsyn_buffer_margin );
|
|
571 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_marginsize_label , 6 , 7 , 0 , 1 ,
|
|
572 GTK_FILL , 0 , 1 , 1 );
|
|
573 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_marginsize_spin , 6 , 7 , 1 , 2 ,
|
|
574 0 , 0 , 1 , 1 );
|
|
575 buffer_vsep[3] = gtk_vseparator_new();
|
|
576 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_vsep[3] , 7 , 8 , 0 , 2 ,
|
|
577 0 , GTK_FILL , 0 , 0 );
|
|
578 /* buffer settings - increment */
|
|
579 buffer_margininc_label = gtk_label_new( "" );
|
|
580 gtk_label_set_markup( GTK_LABEL(buffer_margininc_label) ,
|
|
581 _("<span size=\"smaller\">increment</span>") );
|
|
582 buffer_margininc_spin = gtk_spin_button_new_with_range( 6 , 1000 , 1 );
|
|
583 gtk_spin_button_set_value( GTK_SPIN_BUTTON(buffer_margininc_spin) ,
|
|
584 (gdouble)fsyncfg->fsyn_buffer_increment );
|
|
585 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_margininc_label , 8 , 9 , 0 , 1 ,
|
|
586 GTK_FILL , 0 , 1 , 1 );
|
|
587 gtk_table_attach( GTK_TABLE(buffer_table) , buffer_margininc_spin , 8 , 9 , 1 , 2 ,
|
|
588 0 , 0 , 1 , 1 );
|
|
589
|
|
590 g_object_set_data( G_OBJECT(buffer_tuner_hscale) , "bufsize_spin" , buffer_bufsize_spin );
|
|
591 g_object_set_data( G_OBJECT(buffer_tuner_hscale) , "bufmarginsize_spin" , buffer_marginsize_spin );
|
|
592 g_object_set_data( G_OBJECT(buffer_tuner_hscale) , "bufmargininc_spin" , buffer_margininc_spin );
|
|
593 g_signal_connect_swapped( G_OBJECT(buffer_tuner_defbt) , "clicked" ,
|
|
594 G_CALLBACK(i_configure_ev_buffertuner_default) , buffer_tuner_hscale );
|
|
595 g_signal_connect( G_OBJECT(buffer_tuner_hscale) , "value-changed" ,
|
|
596 G_CALLBACK(i_configure_ev_buffertuner_valuechanged) , NULL );
|
|
597
|
|
598 gtk_box_pack_start( GTK_BOX(content_vbox) , buffer_frame , FALSE , FALSE , 0 );
|
|
599
|
|
600 /* commit events */
|
|
601 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
602 G_CALLBACK(i_configure_ev_sffile_commit) , soundfont_file_entry );
|
|
603 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
604 G_CALLBACK(i_configure_ev_sfload_commit) , soundfont_load_option[0] );
|
|
605 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
606 G_CALLBACK(i_configure_ev_sygain_commit) , synth_gain_value_spin );
|
|
607 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
608 G_CALLBACK(i_configure_ev_sypoly_commit) , synth_poly_value_spin );
|
|
609 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
610 G_CALLBACK(i_configure_ev_syreverb_commit) , synth_reverb_value_option[0] );
|
|
611 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
612 G_CALLBACK(i_configure_ev_sychorus_commit) , synth_chorus_value_option[0] );
|
|
613 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
614 G_CALLBACK(i_configure_ev_sysamplerate_commit) , synth_samplerate_option[3] );
|
|
615 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
616 G_CALLBACK(i_configure_ev_bufsize_commit) , buffer_bufsize_spin );
|
|
617 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
618 G_CALLBACK(i_configure_ev_bufmarginsize_commit) , buffer_marginsize_spin );
|
|
619 g_signal_connect_swapped( G_OBJECT(commit_button) , "clicked" ,
|
|
620 G_CALLBACK(i_configure_ev_bufmargininc_commit) , buffer_margininc_spin );
|
|
621
|
|
622 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , soundfont_file_entry ,
|
|
623 _("* Select SoundFont *\n"
|
|
624 "In order to play MIDI with FluidSynth, you need to specify a "
|
|
625 "valid SoundFont file here (use absolute paths).") , "" );
|
|
626 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , soundfont_load_option[0] ,
|
|
627 _("* Load SoundFont on player start *\n"
|
|
628 "Depending on your system speed, SoundFont loading in FluidSynth will "
|
|
629 "require up to a few seconds. This is a one-time task (the soundfont "
|
|
630 "will stay loaded until it is changed or the backend is unloaded) that "
|
|
631 "can be done at player start, or before the first MIDI file is played "
|
|
632 "(the latter is a better choice if you don't use your player to listen "
|
|
633 "MIDI files only).") , "" );
|
|
634 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , soundfont_load_option[1] ,
|
|
635 _("* Load SoundFont on first midifile play *\n"
|
|
636 "Depending on your system speed, SoundFont loading in FluidSynth will "
|
|
637 "require up to a few seconds. This is a one-time task (the soundfont "
|
|
638 "will stay loaded until it is changed or the backend is unloaded) that "
|
|
639 "can be done at player start, or before the first MIDI file is played "
|
|
640 "(the latter is a better choice if you don't use your player to listen "
|
|
641 "MIDI files only).") , "" );
|
|
642 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_gain_value_spin ,
|
|
643 _("* Synthesizer gain *\n"
|
|
644 "From FluidSynth docs: the gain is applied to the final or master output "
|
|
645 "of the synthesizer; it is set to a low value by default to avoid the "
|
|
646 "saturation of the output when random MIDI files are played.") , "" );
|
|
647 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_poly_value_spin ,
|
|
648 _("* Synthesizer polyphony *\n"
|
|
649 "From FluidSynth docs: the polyphony defines how many voices can be played "
|
|
650 "in parallel; the number of voices is not necessarily equivalent to the "
|
|
651 "number of notes played simultaneously; indeed, when a note is struck on a "
|
|
652 "specific MIDI channel, the preset on that channel may create several voices, "
|
|
653 "for example, one for the left audio channel and one for the right audio "
|
|
654 "channels; the number of voices activated depends on the number of instrument "
|
|
655 "zones that fall in the correspond to the velocity and key of the played "
|
|
656 "note.") , "" );
|
|
657 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_reverb_value_option[0] ,
|
|
658 _("* Synthesizer reverb *\n"
|
|
659 "From FluidSynth docs: when set to \"yes\" the reverb effects module is "
|
|
660 "activated; note that when the reverb module is active, the amount of "
|
|
661 "signal sent to the reverb module depends on the \"reverb send\" generator "
|
|
662 "defined in the SoundFont.") , "" );
|
|
663 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_reverb_value_option[1] ,
|
|
664 _("* Synthesizer reverb *\n"
|
|
665 "From FluidSynth docs: when set to \"yes\" the reverb effects module is "
|
|
666 "activated; note that when the reverb module is active, the amount of "
|
|
667 "signal sent to the reverb module depends on the \"reverb send\" generator "
|
|
668 "defined in the SoundFont.") , "" );
|
|
669 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_chorus_value_option[0] ,
|
|
670 _("* Synthesizer chorus *\n"
|
|
671 "From FluidSynth docs: when set to \"yes\" the chorus effects module is "
|
|
672 "activated; note that when the chorus module is active, the amount of "
|
|
673 "signal sent to the chorus module depends on the \"chorus send\" generator "
|
|
674 "defined in the SoundFont.") , "" );
|
|
675 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_chorus_value_option[1] ,
|
|
676 _("* Synthesizer chorus *\n"
|
|
677 "From FluidSynth docs: when set to \"yes\" the chorus effects module is "
|
|
678 "activated; note that when the chorus module is active, the amount of "
|
|
679 "signal sent to the chorus module depends on the \"chorus send\" generator "
|
|
680 "defined in the SoundFont.") , "" );
|
|
681 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_samplerate_option[0] ,
|
|
682 _("* Synthesizer samplerate *\n"
|
|
683 "The sample rate of the audio generated by the synthesizer. You can also specify "
|
|
684 "a custom value in the interval 22050Hz-96000Hz.\n"
|
|
685 "NOTE: the default buffer parameters are tuned for 44100Hz; changing the sample "
|
|
686 "rate may require buffer params tuning to obtain good sound quality.") , "" );
|
|
687 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_samplerate_option[1] ,
|
|
688 _("* Synthesizer samplerate *\n"
|
|
689 "The sample rate of the audio generated by the synthesizer. You can also specify "
|
|
690 "a custom value in the interval 22050Hz-96000Hz.\n"
|
|
691 "NOTE: the default buffer parameters are tuned for 44100Hz; changing the sample "
|
|
692 "rate may require buffer params tuning to obtain good sound quality.") , "" );
|
|
693 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_samplerate_option[2] ,
|
|
694 _("* Synthesizer samplerate *\n"
|
|
695 "The sample rate of the audio generated by the synthesizer. You can also specify "
|
|
696 "a custom value in the interval 22050Hz-96000Hz.\n"
|
|
697 "NOTE: the default buffer parameters are tuned for 44100Hz; changing the sample "
|
|
698 "rate may require buffer params tuning to obtain good sound quality.") , "" );
|
|
699 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , synth_samplerate_option[3] ,
|
|
700 _("* Synthesizer samplerate *\n"
|
|
701 "The sample rate of the audio generated by the synthesizer. You can also specify "
|
|
702 "a custom value in the interval 22050Hz-96000Hz.\n"
|
|
703 "NOTE: the default buffer parameters are tuned for 44100Hz; changing the sample "
|
|
704 "rate may require buffer params tuning to obtain good sound quality.") , "" );
|
|
705 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , buffer_tuner_defbt ,
|
|
706 _("* FluidSynth backend buffer *\n"
|
|
707 "This button resets the backend buffer parameters to default values.") , "" );
|
|
708 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , buffer_tuner_hscale ,
|
|
709 _("* FluidSynth backend buffer *\n"
|
|
710 "If you notice skips during song playback and your system is not performing "
|
|
711 "any cpu-intensive task (except FluidSynth itself), you may want to tune the "
|
|
712 "buffer in order to prevent skipping. Try to move the \"handy buffer tuner\" "
|
|
713 "a single step to the right until playback is fluid again.") , "" );
|
|
714 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , buffer_bufsize_spin ,
|
|
715 _("* FluidSynth backend buffer *\n"
|
|
716 "It is a good idea to make buffer adjustments with the \"handy buffer tuner\" "
|
|
717 "before resorting to manual editing of buffer parameters.\n"
|
|
718 "However, if you want to fine-tune something and want to know what you're doing, "
|
|
719 "you can understand how these parameters work by reading the backend code "
|
|
720 "(b-fluidsynth.c). In short words, every amount of time "
|
|
721 "(proportional to buffer_SIZE and sample rate), right before gathering samples, "
|
|
722 "the buffer is resized as follows:\n"
|
|
723 "buffer_SIZE + buffer_MARGIN + extramargin\nwhere extramargin is a value "
|
|
724 "computed as number_of_seconds_of_playback / margin_INCREMENT .") , "" );
|
|
725 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , buffer_marginsize_spin ,
|
|
726 _("* FluidSynth backend buffer *\n"
|
|
727 "It is a good idea to make buffer adjustments with the \"handy buffer tuner\" "
|
|
728 "before resorting to manual editing of buffer parameters.\n"
|
|
729 "However, if you want to fine-tune something and want to know what you're doing, "
|
|
730 "you can understand how these parameters work by reading the backend code "
|
|
731 "(b-fluidsynth.c). In short words, every amount of time "
|
|
732 "(proportional to buffer_SIZE and sample rate), right before gathering samples, "
|
|
733 "the buffer is resized as follows:\n"
|
|
734 "buffer_SIZE + buffer_MARGIN + extramargin\nwhere extramargin is a value "
|
|
735 "computed as number_of_seconds_of_playback / margin_INCREMENT .") , "" );
|
|
736 gtk_tooltips_set_tip( GTK_TOOLTIPS(tips) , buffer_margininc_spin ,
|
|
737 _("* FluidSynth backend buffer *\n"
|
|
738 "It is a good idea to make buffer adjustments with the \"handy buffer tuner\" "
|
|
739 "before resorting to manual editing of buffer parameters.\n"
|
|
740 "However, if you want to fine-tune something and want to know what you're doing, "
|
|
741 "you can understand how these parameters work by reading the backend code "
|
|
742 "(b-fluidsynth.c). In short words, every amount of time "
|
|
743 "(proportional to buffer_SIZE and sample rate), right before gathering samples, "
|
|
744 "the buffer is resized as follows:\n"
|
|
745 "buffer_SIZE + buffer_MARGIN + extramargin\nwhere extramargin is a value "
|
|
746 "computed as number_of_seconds_of_playback / margin_INCREMENT .") , "" );
|
|
747 }
|
|
748 else
|
|
749 {
|
|
750 /* display "not available" information */
|
|
751 GtkWidget * info_label;
|
|
752 info_label = gtk_label_new( _("FluidSynth Backend not loaded or not available") );
|
|
753 gtk_box_pack_start( GTK_BOX(fsyn_page_vbox) , info_label , FALSE , FALSE , 2 );
|
|
754 }
|
|
755
|
|
756 gtk_box_pack_start( GTK_BOX(fsyn_page_vbox) , content_vbox , TRUE , TRUE , 2 );
|
|
757 gtk_container_add( GTK_CONTAINER(fsyn_page_alignment) , fsyn_page_vbox );
|
|
758 }
|
|
759
|
|
760
|
|
761 void i_configure_gui_tablabel_fsyn( GtkWidget * fsyn_page_alignment ,
|
|
762 gpointer backend_list_p ,
|
|
763 gpointer commit_button )
|
|
764 {
|
|
765 GtkWidget *pagelabel_vbox, *pagelabel_image, *pagelabel_label;
|
|
766 GdkPixbuf *pagelabel_image_pix;
|
|
767 pagelabel_vbox = gtk_vbox_new( FALSE , 1 );
|
|
768 pagelabel_image_pix = gdk_pixbuf_new_from_xpm_data( (const gchar **)backend_fluidsynth_icon_xpm );
|
|
769 pagelabel_image = gtk_image_new_from_pixbuf( pagelabel_image_pix ); g_object_unref( pagelabel_image_pix );
|
|
770 pagelabel_label = gtk_label_new( "" );
|
|
771 gtk_label_set_markup( GTK_LABEL(pagelabel_label) , "<span size=\"smaller\">FluidSynth\nbackend</span>" );
|
|
772 gtk_label_set_justify( GTK_LABEL(pagelabel_label) , GTK_JUSTIFY_CENTER );
|
|
773 gtk_box_pack_start( GTK_BOX(pagelabel_vbox) , pagelabel_image , FALSE , FALSE , 1 );
|
|
774 gtk_box_pack_start( GTK_BOX(pagelabel_vbox) , pagelabel_label , FALSE , FALSE , 1 );
|
|
775 gtk_container_add( GTK_CONTAINER(fsyn_page_alignment) , pagelabel_vbox );
|
|
776 gtk_widget_show_all( fsyn_page_alignment );
|
|
777 return;
|
|
778 }
|
|
779
|
|
780
|
|
781 void i_configure_cfg_fsyn_alloc( void )
|
|
782 {
|
|
783 amidiplug_cfg_fsyn_t * fsyncfg = g_malloc(sizeof(amidiplug_cfg_fsyn_t));
|
|
784 amidiplug_cfg_backend->fsyn = fsyncfg;
|
|
785 }
|
|
786
|
|
787
|
|
788 void i_configure_cfg_fsyn_free( void )
|
|
789 {
|
|
790 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
791 g_free( fsyncfg->fsyn_soundfont_file );
|
|
792 }
|
|
793
|
|
794
|
|
795 void i_configure_cfg_fsyn_read( pcfg_t * cfgfile )
|
|
796 {
|
|
797 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
798
|
|
799 if (!cfgfile)
|
|
800 {
|
|
801 /* fluidsynth backend defaults */
|
|
802 fsyncfg->fsyn_soundfont_file = g_strdup( "" );
|
|
803 fsyncfg->fsyn_soundfont_load = 1;
|
|
804 fsyncfg->fsyn_synth_samplerate = 44100;
|
|
805 fsyncfg->fsyn_synth_gain = -1;
|
|
806 fsyncfg->fsyn_synth_poliphony = -1;
|
|
807 fsyncfg->fsyn_synth_reverb = -1;
|
|
808 fsyncfg->fsyn_synth_chorus = -1;
|
|
809 fsyncfg->fsyn_buffer_size = 512;
|
|
810 fsyncfg->fsyn_buffer_margin = 10;
|
|
811 fsyncfg->fsyn_buffer_increment = 18;
|
|
812 }
|
|
813 else
|
|
814 {
|
|
815 i_pcfg_read_string( cfgfile , "fsyn" , "fsyn_soundfont_file" , &fsyncfg->fsyn_soundfont_file , "" );
|
|
816 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_soundfont_load" , &fsyncfg->fsyn_soundfont_load , 1 );
|
|
817 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_synth_samplerate" , &fsyncfg->fsyn_synth_samplerate , 44100 );
|
|
818 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_synth_gain" , &fsyncfg->fsyn_synth_gain , -1 );
|
|
819 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_synth_poliphony" , &fsyncfg->fsyn_synth_poliphony , -1 );
|
|
820 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_synth_reverb" , &fsyncfg->fsyn_synth_reverb , -1 );
|
|
821 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_synth_chorus" , &fsyncfg->fsyn_synth_chorus , -1 );
|
|
822 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_buffer_size" , &fsyncfg->fsyn_buffer_size , 512 );
|
|
823 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_buffer_margin" , &fsyncfg->fsyn_buffer_margin , 15 );
|
|
824 i_pcfg_read_integer( cfgfile , "fsyn" , "fsyn_buffer_increment" , &fsyncfg->fsyn_buffer_increment , 18 );
|
|
825 }
|
|
826 }
|
|
827
|
|
828
|
|
829 void i_configure_cfg_fsyn_save( pcfg_t * cfgfile )
|
|
830 {
|
|
831 amidiplug_cfg_fsyn_t * fsyncfg = amidiplug_cfg_backend->fsyn;
|
|
832
|
|
833 i_pcfg_write_string( cfgfile , "fsyn" , "fsyn_soundfont_file" , fsyncfg->fsyn_soundfont_file );
|
|
834 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_soundfont_load" , fsyncfg->fsyn_soundfont_load );
|
|
835 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_synth_samplerate" , fsyncfg->fsyn_synth_samplerate );
|
|
836 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_synth_gain" , fsyncfg->fsyn_synth_gain );
|
|
837 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_synth_poliphony" , fsyncfg->fsyn_synth_poliphony );
|
|
838 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_synth_reverb" , fsyncfg->fsyn_synth_reverb );
|
|
839 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_synth_chorus" , fsyncfg->fsyn_synth_chorus );
|
|
840 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_buffer_size" , fsyncfg->fsyn_buffer_size );
|
|
841 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_buffer_margin" , fsyncfg->fsyn_buffer_margin );
|
|
842 i_pcfg_write_integer( cfgfile , "fsyn" , "fsyn_buffer_increment" , fsyncfg->fsyn_buffer_increment );
|
|
843 }
|