summaryrefslogtreecommitdiffstats
path: root/mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'mixer.c')
-rw-r--r--mixer.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mixer.c b/mixer.c
index e18d1da..d0685e8 100644
--- a/mixer.c
+++ b/mixer.c
@@ -752,6 +752,10 @@ int tinyalsa_mixer_set_route(struct tinyalsa_mixer *mixer,
goto error_mixer;
}
+ // No need to disable and enable the same route
+ if(mixer_device == mixer_io->device_current)
+ goto exit_mixer;
+
if(mixer_io->device_current != NULL) {
rc = tinyalsa_mixer_set_route_list(mixer, mixer_io->device_current->disable);
if(rc < 0) {
@@ -768,6 +772,7 @@ int tinyalsa_mixer_set_route(struct tinyalsa_mixer *mixer,
mixer_io->device_current = mixer_device;
+exit_mixer:
mixer_close(mixer->mixer);
mixer->mixer = NULL;
@@ -1028,7 +1033,6 @@ int tinyalsa_mixer_set_state(struct tinyalsa_mixer *mixer,
mixer_io->device_current = NULL;
mixer_io->state = state;
-exit_mixer:
mixer_close(mixer->mixer);
mixer->mixer = NULL;