Search code examples
audioalsa

Strange status changed in alsamixer


My audio system is simple: two speakers in the rear panel--front left(FL) ,front right(FR) ,headphone in the front panel. The primitive status is as below--primitive status: enter image description here
In this status , sound can be heared from FL,FR,and headphone.

I find a strange fact that master,front,surround in alsamixer changed into MM status when to click M on LFE,i move the cursor on LFE,and click M,LFE changed into MM,at the same time master,front,surround all changed into MM status !No sound can be heared !
enter image description here

And i click M for the second time on LFE,all status changed as below:

enter image description here Let's go on from the primitive status,and unplug line from rear panel,no sound in headphone! The status in alsamixer gui is as below: enter image description here
Now re-plug the line in the rear panel,the status in alsamixer gui turns into :

enter image description here

Please give an explanation in detail.


Solution

  • To see what's going on:

    • In one terminal window, run alsactl monitor.
    • In another terminal window, run alsamixer.
    • As you mute/unmute things in alsamixer, you can see the control commands in the monitor window. You should see multiple switch commands show up when you mute the LFE.

    The reason this is happening is because of the pulseaudio profile in use by alsamixer.

    • Profiles are located in /usr/share/pulseaudio/alsa-mixer/profile-sets/*.conf
    • Paths are located in /usr/share/pulseaudio/alsa-mixer/paths/*.conf

    So which ones are in use? You can check that with pacmd info | grep "active", which may produce something like:

        active port: <analog-output-speaker>
        active port: <analog-input-headphone-mic>
        active profile: <output:analog-stereo+input:analog-stereo>
    

    Ok, so the output mapping is analog-stereo. I can find this in /usr/share/pulseaudio/alsa-mixer/profile-sets/default.conf. It contains the following:

    [Mapping analog-stereo]
    device-strings = front:%f hw:%f
    channel-map = left,right
    paths-output = analog-output analog-output-lineout analog-output-speaker analog-output-headphones analog-output-headphones-2
    paths-input = analog-input-front-mic analog-input-rear-mic analog-input-internal-mic analog-input-dock-mic analog-input analog-input-mic analog-input-linein analog-input-aux analog-input-video analog-input-tvtuner analog-input-fm analog-input-mic-line analog-input-headphone-mic analog-input-headset-mic
    priority = 10
    

    The real control is under /usr/share/pulseaudio/alsa-mixer/paths/analog-output-speaker.conf. You can read /usr/share/pulseaudio/alsa-mixer/paths/analog-output.conf.common for details, where we see two important sections:

    ; When a device shall be muted/unmuted *all* elements listed in a path
    ; file with "switch = mute" will be toggled.
    

    (there's a bit of a caveat to this one. It seems that unmuting does NOT toggle other elements in the path)

    and

    ; [Element ...]                          # For each element that we shall control
    ...
    ; switch = ignore | mute | off | on | select # What to do with this switch: ignore it, make it follow mute status,
    ;                                            # always set it to off, always to on, or make it selectable as port.
    ;                                            # If set to 'select' you need to define an Option section for on
    ;                                            # and off
    ...
    

    So now, if we want to adjust an element such that it's always on, always off, or simply ignores muting, we would set the corresponding switch= values in the Element of interest.

    If you want to adjust the behavior of the headphones when activating that path (i.e. when plugging them in), change the Element values in paths/analog-output-headphones.conf