X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=plugins%2Faudio%2Faudio-alsa.c;h=51f497027cf524e3f6b86d028db9b7f28c3d7b3e;hb=14c6ab749e9ccfdde8d191c10e2d0426da53df1f;hp=8a4caf213f6a748afdf332a8ce713eab51828cc6;hpb=07c775201fbd9477bd4a69cee3d48a95eb612bc6;p=src%2Fapp-framework-binder.git diff --git a/plugins/audio/audio-alsa.c b/plugins/audio/audio-alsa.c index 8a4caf21..51f49702 100644 --- a/plugins/audio/audio-alsa.c +++ b/plugins/audio/audio-alsa.c @@ -221,18 +221,27 @@ PUBLIC unsigned char _alsa_get_mute (unsigned int num) { snd_mixer_selem_get_playback_switch (elm_m, SND_MIXER_SCHN_FRONT_RIGHT, &mute); } - return (unsigned char)!mute; + if (dev_ctx[num]->mixer_elm_m) + return (unsigned char)mute; + else + return (unsigned char)!mute; } -PUBLIC void _alsa_set_mute (unsigned int num, unsigned char mute) { +PUBLIC void _alsa_set_mute (unsigned int num, unsigned char tomute) { snd_mixer_elem_t *elm_m; + int mute; - if (!dev_ctx || !dev_ctx[num] || !dev_ctx[num]->mixer_elm || 1 < mute < 0) + if (!dev_ctx || !dev_ctx[num] || !dev_ctx[num]->mixer_elm || 1 < tomute < 0) return; - dev_ctx[num]->mixer_elm_m ? (elm_m = dev_ctx[num]->mixer_elm_m) : - (elm_m = dev_ctx[num]->mixer_elm); + if (dev_ctx[num]->mixer_elm_m) { + elm_m = dev_ctx[num]->mixer_elm_m; + mute = (int)!tomute; + } else { + elm_m = dev_ctx[num]->mixer_elm; + mute = (int)tomute; + } if (snd_mixer_selem_has_playback_switch (elm_m)) snd_mixer_selem_set_playback_switch_all (elm_m, !mute);