It is impossible to set any of the sliders to "off" (0, zero, nil, etc). Reproducible: Always Steps to Reproduce: 1. Turn your speakers' volume up high 2. Open xfce4-mixer, maximize the PCM slider 3. Minimize the Master slider 4. (optional) run alsamixer in an xterm, Master is not 0 Actual Results: the Master volume was set to 1 (sound was audible) Expected Results: set the Master volume to 0 (sound is off) I could not build xfce4-mixer from CVS head and so have not checked if this has been fixed. I also could not figure out what was going on with all the .gob files and could not muster up a patch.
This is not possible with most sound cards in alsa. xfce4-mixer sets the alsa "mute flag" when reducing the volume to 0 instead (and sets the alsa volume to 1). If the setting of the mute flag doesnt work, that is would be a bug :) although not neccessarily with xfce4-mixer. see lib/vc_alsa.c vc_set_volume snd_mixer_selem_set_playback_switch (add a debug message there please and start xfce4-mixer from a terminal and see if it is reached) like, if (lval == pmin) { /* mute */ g_warning ("setting mute"); snd_mixer_selem_set_playback_switch (xelem, chn, 0); return; } else { /* unmute, just in case. */ g_warning ("no mute"); snd_mixer_selem_set_playback_switch (xelem, chn, 1); snd_mixer_selem_set_playback_volume(xelem, chn, lval); } Thanks
Thanks for the pointer to the code I'm interested in. When you say it's not possible with most cards, does that mean there are problems if you try and set the volume to zero? Taking the line below outside of the if construct corrects my problem for the Master slider, but not for PCM. I suppose that is what you meant by "not possible with most cards". :) snd_mixer_selem_set_playback_volume(xelem, chn, lval); if (lval == pmin) { /* mute */ g_warning ("setting mute"); snd_mixer_selem_set_playback_switch (xelem, chn, 0); return; } else { /* unmute, just in case. */ g_warning ("unsetting mute"); snd_mixer_selem_set_playback_switch (xelem, chn, 1); /*snd_mixer_selem_set_playback_volume(xelem, chn, lval);*/ } This code is indeed reached and I can see the debug messages on the console, but the mute does not seem to be working since I can still hear sound. Am I right in assuming that this is probably an ALSA bug now? If you have no objections to the above change (and if it does not break anything for others!) I'd like to see it implemented. If not, well I'm going to try and track down the mute issue anyways. :) -------- After a bit of digging through the alsamixer source and alsa headers, I came up with some code that mutes Master and PCM correctly for me. I won't pretend to have any ALSA experience so if this is completely ludicrous I apologize. However, it doesn't seem as if xfce4-mixer has any reason to support muting only left/right channels (who does that?) so IMO this should be fine. My new proposed change is to replace the entire "for (chn=0; chn<SND_MIXER_CHN_LAST; chn++)" loop with the following lines: (any checks we need to do with snd_mixer_selem_has_playback*?) snd_mixer_selem_set_playback_volume_all(xelem, lval); if (lval == pmin) { /* mute */ snd_mixer_selem_set_playback_switch_all(xelem, 0); } else { /* unmute, just in case. */ snd_mixer_selem_set_playback_switch_all(xelem, 1); }
huh, when you comment out /*snd_mixer_selem_set_playback_volume(xelem, chn, lval);*/ you wont be able to change volume anymore. Or what do you mean with "above change" ? :) Anyways, I used the _all way in cvs head now (totally untested yet), can you try if that works ?
Sorry Danny, I am unable to build the CVS code. I did a 'cvs up' in my xfce4-mixer dir and then ran ./autogen.sh --with-sound=alsa, however configure fails with: [...] checking for perl... /usr/bin/perl checking for XML::Parser... ok checking what sound system to use... ./configure: line 21253: syntax error near unexpected token `ALSA,' ./configure: line 21253: ` XDT_CHECK_PACKAGE(ALSA, alsa, 0.9.0)' Perhaps I should check for a new xdt-autogen, but for now it is not so important. (I don't think, read on for why) You are 100% correct about the code in CVS not changing the volume. I should have pointed out that I took this line[1] out of the if (lval == pmin) {...} block and placed it before the mute/unmute takes place. I did this so it would always execute. When Master is 0 the sound is off, so even if it does not /always/ work ie. for PCM, I think it is useful to let it be 0 anyways for the occasions it may work. [1] snd_mixer_selem_set_playback_volume_all(xelem, lval); My last comment was unclear, I wrote the first half, did some tinkering and then wrote the second half but I did not mention that fact. Sorry for the confusion. If you add that one line[1] into CVS I believe it will work. I currently am running that code in a modified xfce4-mixer-4.2.0 with no problems. The CVS code does not look different from 4.2.0, at least not in vc_set_volume.
Just to be as clear as possible, I propose the following code: /* use _all functions for sami's card ... */ snd_mixer_selem_set_playback_volume_all(xelem, lval); if (lval == pmin) /* mute */ snd_mixer_selem_set_playback_switch_all (xelem, 0); else /* unmute, just in case. */ snd_mixer_selem_set_playback_switch_all (xelem, 1); Taking a look through the ALSA API[1] my guess was confirmed. The snd_mixer_selem_set_playback_*_all functions serve as a way to change all channels for a mixer element with one function call. [1] http://www.alsa-project.org/alsa-doc/alsa-lib/mixer_2simple_8c.html#a48
I see.. dont know why that is different to doing a for loop over all the channels manually and setting each... but I guess they do weird things internally. So ok, lets have alsa do the for loop :) committed to cvs head.
I am unsure why it works differently, but thank you for committing the fix. Using the recently updated xdt-autogen I successfully built xfce4-mixer from cvs head today. It works as expected. Thank you again, for all the work you do on Xfce. Have a nice day. :)