@@ -47,12 +47,13 @@ gtk_enum_sound_callback (const char *name, const char *desc, void *userdata) {
4747 GtkComboBox * combobox = GTK_COMBO_BOX (userdata );
4848 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox ), desc );
4949
50- deadbeef -> conf_lock ();
51- const char * curr = deadbeef -> conf_get_str_fast (_get_output_soundcard_conf_name (), "default" );
52- if (!strcmp (curr , name )) {
53- gtk_combo_box_set_active (combobox , g_slist_length (output_device_names ));
50+ {
51+ char soundcard_name [100 ];
52+ deadbeef -> conf_get_str (_get_output_soundcard_conf_name (), "default" , soundcard_name , sizeof (soundcard_name ));
53+ if (!strcmp (soundcard_name , name )) {
54+ gtk_combo_box_set_active (combobox , g_slist_length (output_device_names ));
55+ }
5456 }
55- deadbeef -> conf_unlock ();
5657
5758 output_device_names = g_slist_append (output_device_names , g_strdup (name ));
5859}
@@ -68,12 +69,13 @@ prefwin_fill_soundcards (void) {
6869
6970 gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox ), _ ("Default Audio Device" ));
7071
71- deadbeef -> conf_lock ();
72- const char * s = deadbeef -> conf_get_str_fast (_get_output_soundcard_conf_name (), "default" );
73- if (!strcmp (s , "default" )) {
74- gtk_combo_box_set_active (combobox , 0 );
72+ {
73+ char soundcard_name [100 ];
74+ deadbeef -> conf_get_str (_get_output_soundcard_conf_name (), "default" , soundcard_name , sizeof (soundcard_name ));
75+ if (!strcmp (soundcard_name , "default" )) {
76+ gtk_combo_box_set_active (combobox , 0 );
77+ }
7578 }
76- deadbeef -> conf_unlock ();
7779
7880 if (output_device_names ) {
7981 for (GSList * dev = output_device_names ; dev ; dev = dev -> next ) {
@@ -103,17 +105,18 @@ on_pref_output_plugin_changed (GtkComboBox *combobox,
103105 DB_output_t * prev = NULL ;
104106 DB_output_t * new = NULL ;
105107
106- deadbeef -> conf_lock ();
107- const char * outplugname = deadbeef -> conf_get_str_fast ("output_plugin" , "alsa" );
108- for (int i = 0 ; out_plugs [i ]; i ++ ) {
109- if (!strcmp (out_plugs [i ]-> plugin .id , outplugname )) {
110- prev = out_plugs [i ];
111- }
112- if (i == active ) {
113- new = out_plugs [i ];
108+ {
109+ char outplugname [100 ];
110+ deadbeef -> conf_get_str ("output_plugin" , "alsa" , outplugname , sizeof (outplugname ));
111+ for (int i = 0 ; out_plugs [i ]; i ++ ) {
112+ if (!strcmp (out_plugs [i ]-> plugin .id , outplugname )) {
113+ prev = out_plugs [i ];
114+ }
115+ if (i == active ) {
116+ new = out_plugs [i ];
117+ }
114118 }
115119 }
116- deadbeef -> conf_unlock ();
117120
118121 if (!new ) {
119122 fprintf (stderr , "failed to find output plugin selected in preferences window\n" );
@@ -132,14 +135,13 @@ on_pref_soundcard_changed (GtkComboBox *combobox,
132135{
133136 int active = gtk_combo_box_get_active (combobox );
134137 if (active >= 0 && active < g_slist_length (output_device_names )) {
135- deadbeef -> conf_lock () ;
136- const char * soundcard = deadbeef -> conf_get_str_fast (_get_output_soundcard_conf_name (), "default" );
138+ char soundcard [ 100 ] ;
139+ deadbeef -> conf_get_str (_get_output_soundcard_conf_name (), "default" , soundcard , sizeof ( soundcard ) );
137140 const char * active_name = g_slist_nth_data (output_device_names , active );
138141 if (strcmp (soundcard , active_name )) {
139142 deadbeef -> conf_set_str (_get_output_soundcard_conf_name (), active_name );
140143 deadbeef -> sendmessage (DB_EV_CONFIGCHANGED , 0 , 0 , 0 );
141144 }
142- deadbeef -> conf_unlock ();
143145 }
144146}
145147
@@ -224,12 +226,15 @@ prefwin_init_sound_tab (GtkWidget *_prefwin) {
224226 GtkWidget * w = prefwin = _prefwin ;
225227 GtkComboBox * combobox = GTK_COMBO_BOX (lookup_widget (w , "pref_output_plugin" ));
226228
227- const char * outplugname = deadbeef -> conf_get_str_fast ("output_plugin" , "alsa" );
228- DB_output_t * * out_plugs = deadbeef -> plug_get_output_list ();
229- for (int i = 0 ; out_plugs [i ]; i ++ ) {
230- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox ), out_plugs [i ]-> plugin .name );
231- if (!strcmp (outplugname , out_plugs [i ]-> plugin .id )) {
232- gtk_combo_box_set_active (combobox , i );
229+ {
230+ char outplugname [100 ];
231+ deadbeef -> conf_get_str ("output_plugin" , "alsa" , outplugname , sizeof (outplugname ));
232+ DB_output_t * * out_plugs = deadbeef -> plug_get_output_list ();
233+ for (int i = 0 ; out_plugs [i ]; i ++ ) {
234+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combobox ), out_plugs [i ]-> plugin .name );
235+ if (!strcmp (outplugname , out_plugs [i ]-> plugin .id )) {
236+ gtk_combo_box_set_active (combobox , i );
237+ }
233238 }
234239 }
235240
@@ -263,9 +268,15 @@ prefwin_init_sound_tab (GtkWidget *_prefwin) {
263268 prefwin_set_toggle_button ("checkbutton_dependent_sr" , use_dependent_samplerate );
264269
265270 // direct samplerate value
266- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (lookup_widget (w , "comboboxentry_direct_sr" )))), deadbeef -> conf_get_str_fast ("streamer.samplerate" , "44100" ));
267- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (lookup_widget (w , "comboboxentry_sr_mult_48" )))), deadbeef -> conf_get_str_fast ("streamer.samplerate_mult_48" , "48000" ));
268- gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (lookup_widget (w , "comboboxentry_sr_mult_44" )))), deadbeef -> conf_get_str_fast ("streamer.samplerate_mult_44" , "44100" ));
271+ {
272+ char samplerate [100 ];
273+ deadbeef -> conf_get_str ("streamer.samplerate" , "44100" , samplerate , sizeof (samplerate ));
274+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (lookup_widget (w , "comboboxentry_direct_sr" )))), samplerate );
275+ deadbeef -> conf_get_str ("streamer.samplerate_mult_48" , "48000" , samplerate , sizeof (samplerate ));
276+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (lookup_widget (w , "comboboxentry_sr_mult_48" )))), samplerate );
277+ deadbeef -> conf_get_str ("streamer.samplerate_mult_44" , "44100" , samplerate , sizeof (samplerate ));
278+ gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (lookup_widget (w , "comboboxentry_sr_mult_44" )))), samplerate );
279+ }
269280
270281 update_samplerate_widget_sensitivity (override_sr , use_dependent_samplerate );
271282}
0 commit comments