summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-13 18:20:16 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-12-13 18:20:16 +0100
commit0cf3d99ae315123cfd194db8092c6693380397c4 (patch)
treed53385dede87c0099a50cdfa117c979068665be8 /plugins
parent115ade96d95d5149837b365e56d46af61a3df04c (diff)
prevent sound reinit on every access to preferences window
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/callbacks.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c
index 1aa3d6b9..40f0e63b 100644
--- a/plugins/gtkui/callbacks.c
+++ b/plugins/gtkui/callbacks.c
@@ -1470,8 +1470,11 @@ on_pref_soundcard_changed (GtkComboBox *combobox,
{
int active = gtk_combo_box_get_active (combobox);
if (active >= 0 && active < num_alsa_devices) {
- deadbeef->conf_set_str ("alsa_soundcard", alsa_device_names[active]);
- deadbeef->sendmessage (M_CONFIGCHANGED, 0, 0, 0);
+ const char *soundcard = deadbeef->conf_get_str ("alsa_soundcard", "default");
+ if (strcmp (soundcard, alsa_device_names[active])) {
+ deadbeef->conf_set_str ("alsa_soundcard", alsa_device_names[active]);
+ deadbeef->sendmessage (M_CONFIGCHANGED, 0, 0, 0);
+ }
}
}
@@ -1485,6 +1488,7 @@ on_pref_output_plugin_changed (GtkComboBox *combobox,
DB_output_t **out_plugs = deadbeef->plug_get_output_list ();
DB_output_t *prev = NULL;
DB_output_t *new = NULL;
+
for (int i = 0; out_plugs[i]; i++) {
if (!strcmp (out_plugs[i]->plugin.name, outplugname)) {
prev = out_plugs[i];
@@ -1493,12 +1497,15 @@ on_pref_output_plugin_changed (GtkComboBox *combobox,
new = out_plugs[i];
}
}
+
if (!new) {
fprintf (stderr, "failed to find output plugin selected in preferences window\n");
}
else {
- deadbeef->conf_set_str ("output_plugin", new->plugin.name);
- deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
+ if (prev != new) {
+ deadbeef->conf_set_str ("output_plugin", new->plugin.name);
+ deadbeef->sendmessage (M_REINIT_SOUND, 0, 0, 0);
+ }
}
}