Summary: | Unable to properly switch between Speakers and Headphones (has "workaround") | ||
---|---|---|---|
Product: | PulseAudio | Reporter: | gbr |
Component: | alsa | Assignee: | pulseaudio-bugs |
Status: | RESOLVED MOVED | QA Contact: | pulseaudio-bugs |
Severity: | normal | ||
Priority: | medium | CC: | lennart |
Version: | unspecified | ||
Hardware: | x86-64 (AMD64) | ||
OS: | Linux (All) | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: |
pactl list sinks
amixer -c0 with "Line Out" set as default port and "Auto-Mute Mode" set to Enabled amixer -c0: "Headphones" set as default port / "Auto-Mute Mode" set to Disabled / [Element Front] switch=off,volume=off |
Description
gbr
2018-03-21 10:27:22 UTC
Sorry, I forgot to add the second part of the workaround. To exclusively output audio to your headphones back again, you'd have to simply set "Auto-Mute Mode" to "Enabled". Thanks for the clear problem description! My impression is that alsa usually sets "Auto-Mute Mode" to "Disabled" by default. If this doesn't happen on your machine, that issue could be reported to the alsa developers. That said, it would probably be a good idea to force it in PulseAudio, since as far as I can tell, enabling auto-mute in alsa is completely useless and can only cause confusion when using PulseAudio, since PulseAudio is perfectly capable of automatically muting unwanted outputs by itself (well, except that in your case there seems to be some problem with muting headphones when selecting the lineout port). The issue that lineout is marked as unavailable ("unplugged" in pavucontrol) is something that should be fixed. That behaviour was deliberately changed to what it is now, but I think the reason behind that change was not very good: if alsa auto-mutes lineout when headphones are plugged in, we wanted to make clear that lineout isn't usable in that situation. But if the auto-muting in alsa is disabled, then it's wrong to mark the lineout port as unavailable. Maybe in the past it was more common to have auto-muting enabled in alsa (and it might not have been even configurable). It sounds strange that muting headphones works when you have auto-mute enabled and doesn't work when you have auto-mute disabled. It should make no difference to how pulseaudio configures the mixer. I suspect this is a bug in the kernel driver, but I'd like to check the mixer settings anyway, so could you attach the output of "amixer -c0" when you have enabled auto-mute in alsa and selected the lineout port in pulseaudio? Created attachment 138240 [details]
amixer -c0 with "Line Out" set as default port and "Auto-Mute Mode" set to Enabled
(In reply to Tanu Kaskinen from comment #2) > Thanks for the clear problem description! > > since PulseAudio is perfectly capable of automatically muting > unwanted outputs by itself (well, except that in your case there seems to be > some problem with muting headphones when selecting the lineout port). Actually no, the main problem is that the Line Out port does NOT get muted unless Auto-Mute Mode is set to Enabled, so I get audio output in both ports. The Headphone behaves perfectly fine, despite of how Auto-Mute Mode is set, at least from my tests. Sorry for the misundertanding. This is not a kernel driver bug. Or it kind of is, but I don't think it will be fixed. There is a general design problem with snd_hda_intel, as it doesn't specify whether the "Front" mixer element applies to the headphone output or not. On some machines it does, on your machine it doesn't. PulseAudio doesn't mute the Front element when using the headphone port, because that would result in no audio on some machines. As a workaround you can edit /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf. Change this [Element Front] switch = mute volume = zero to [Element Front] switch = off volume = off We should add special configuration for you hardware so that it works out of the box. Some details for my own reference: Motherboard and audio codec: ASRock B75M-DGS R2.0 (5.1 CH HD Audio (Realtek ALC662 Audio Codec)) udev identification: ATTRS{subsystem_vendor}=="0x8086", ATTRS{subsystem_device}=="0x1e20" (In reply to Tanu Kaskinen from comment #5) > Sorry for the misundertanding. Please don't even worry about it! > This is not a kernel driver bug. Or it kind of is, but I don't think it will > be fixed. There is a general design problem with snd_hda_intel, as it > doesn't specify whether the "Front" mixer element applies to the headphone > output or not. On some machines it does, on your machine it doesn't. > PulseAudio doesn't mute the Front element when using the headphone port, > because that would result in no audio on some machines. That's really interesting and it makes complete sense, but ironically now I don't get audio in my headphones no matter what options or port I choose. Also: When the Line Out port is selected AND Auto-Mute is disabled, I do get audio in my speakers. When the Line Out port is selected AND Auto-Mute is enabled, I do not get any audio in my speakers. Isn't that weird? It sounds like your headphones are muted - check if that's the case. If they don't seem to be muted, then attach the output of "amixer -c0" when you have selected the headphone port. Hmm, did you apply the workaround in analog-output-headphones.conf? Maybe the Front element actually does affect the headphone output, in which case it must not be set to off in analog-output-headphones.conf. I said previously that it doesn't affect the headphone output on your machine, but I actually don't have any evidence for that statement. The lineout port is behaving as expected. If auto-mute is enabled in alsa, then lineout will be muted always when you have headphones plugged in. Auto-mute must be disabled if you wish to use lineout while having headphones plugged in. It seems I blamed the kernel too soon. In my experience, usually "Front" is the only element that controls whether audio goes to lineout, which is why I jumped to the conclusion that the ambiguity of the Front element semantics is to blame, but it seems that you have a "Line" playback switch, which can probably be used to mute the speakers without muting the headphones. PulseAudio currently ignores that element, so try adding this to /usr/share/pulseaudio/alsa-mixer/paths/analog-output-lineout.conf: [Element Line] switch = mute volume = merge ...and this to /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf: [Element Line] switch = off volume = off (In reply to Tanu Kaskinen from comment #7) > It sounds like your headphones are muted - check if that's the case. After I applied your first suggestion, here's how alsamixer looks like when: * "Line Out (unplugged)" port is selected (in pavucontrol): https://i.imgur.com/19DS9bN.png * "Headphones (plugged in)" port is selected (in pavucontrol): https://i.imgur.com/ZxqWNSJ.png To summarize: When "Line Out" is selected, I hear audio coming from speakers and not from headphones -- perfect. But when "Headphones" is selected, I can't hear anything at all, in both headphones and speakers. > If they don't seem to be muted, then attach the output of "amixer -c0" > when you have selected the headphone port. They don't seem to be muted (there's no "MM" under it), but in the other hand, the Headphone item set to "Off, Off" in alsamixer (see first screenshot), so I can't manipulate its volume. But I'm attaching the output of "amixer -c0" anyway. > Hmm, did you apply the workaround in analog-output-headphones.conf? Yes. > Maybe the Front element actually does affect the headphone output, I think it does as well. > The lineout port is behaving as expected. If auto-mute is enabled in alsa, > then lineout will be muted always when you have headphones plugged in. That's correct and I can reproduce it. That's why the workaround I suggested involves enabling Auto-Mute when I want to exclusively use my Headphones and mute my speakers. Obviously, I have no clue what Auto-Mute does, but it'd be great if there was a way for PulseAudio to automatically enable Auto-Mute for me when I want to exclusively use my headphones and not my speakers; And then PulseAudio would disable Auto-Mute when I switch back to speakers. > Auto-mute must be disabled if you wish to use lineout while having > headphones plugged in. Okay, I guess I should only try new settings with Auto-Mute disabled from now on. > PulseAudio currently ignores that element, so try adding this to > /usr/share/pulseaudio/alsa-mixer/paths/analog-output-lineout.conf: > > [Element Line] > switch = mute > volume = merge > > ...and this to > /usr/share/pulseaudio/alsa-mixer/paths/analog-output-headphones.conf: > > [Element Line] > switch = off > volume = off I'm sad to say that this had no effect whatsoever; Well, at least none of the issues above were directly affected. I added those lines at end of both files because there wasn't any "[Element Line]" in there, did I do it right? Anyway, I must say I'm really greateful for your help though, so thank you very much! I don't know if I can provide anything else to help you help me, but whatever you may need, just ask me and I'll do my best to fulfill it. Created attachment 138287 [details]
amixer -c0: "Headphones" set as default port / "Auto-Mute Mode" set to Disabled / [Element Front] switch=off,volume=off
Ok, undo the [Element Front] change, since it muted the headphones permanently. It sounds like the Line element isn't doing anything. Can you verify that? Remove or comment out the [Element Line] section from both conf files, then restart pulseaudio and select the headphone port (you should get audio in the speakers as well), and then with alsamixer test if muting or changing volume of the Line element has any effect on the speaker output. If it doesn't have any effect, this should be reported to alsa. Instructions here: http://alsa-project.org/main/index.php/Bug_Tracking (remember to give them the alsa-info output, for some reasons when I point people to those instructions they still sometimes fail to follow them when filing bug reports to alsa). Here's a new attempt at a workaround in pulseaudio: put this in analog-output-headphones.conf: [Element Auto-Mute Mode] enumeration = select [Option Auto-Mute Mode:Enabled] name = auto-mute-on and this in analog-output-lineout.conf: [Element Auto-Mute Mode] enumeration = select [Option Auto-Mute Mode:Disabled] name = auto-mute-off I don't want to add this workaround to pulseaudio, since it's so clearly a bug in alsa and the workaround is very ugly, but if it turns out that your alsa bug report doesn't lead to a fix (it happens), then I will have to consider doing this anyway in pulseaudio. (In reply to Tanu Kaskinen from comment #10) > Ok, undo the [Element Front] change, since it muted the headphones > permanently. Done. > It sounds like the Line element isn't doing anything. Can you verify that? > Remove or comment out the [Element Line] section from both conf files, then > restart pulseaudio and select the headphone port (you should get audio in > the speakers as well), and then with alsamixer test if muting or changing > volume of the Line element has any effect on the speaker output. Yes, that's exactly what's happening! I did all that, then I opened alsamixer and the "Line" element was already muted by default, and unmuting it or changing its volume didn't affect anything; I could still hear the audio coming from both Headphones and Speakers no matter what. > If it doesn't have any effect, this should be reported to alsa. > Instructions here: > http://alsa-project.org/main/index.php/Bug_Tracking (remember to give them > the alsa-info output, for some reasons when I point people to those > instructions they still sometimes fail to follow them when filing bug > reports to alsa). Thanks for pointing the directions, I'll definitely open a ticket there, but what title and description do you think I should choose? I'm not sure exactly what this bug is and I wouldn't want to "guess" a title/description for it, since I could be misleading... > Here's a new attempt at a workaround in pulseaudio: put this in > analog-output-headphones.conf: > > [Element Auto-Mute Mode] > enumeration = select > > [Option Auto-Mute Mode:Enabled] > name = auto-mute-on > > and this in analog-output-lineout.conf: > > [Element Auto-Mute Mode] > enumeration = select > > [Option Auto-Mute Mode:Disabled] > name = auto-mute-off > Oh my God, thank you soooo much! It worked perfectly!!! Pavucontrol still shows "Line Out" as "unplugged", but I can switch to it and it will still work as expected. Thanks again! On a side note, here's something curious: I also have Windows 10 installed on this machine, in dual boot with Arch Linux. But when I'm on Windows, I *have to* NOT install the official Realtek drivers, otherwise it will "unify" my Headphones and Speakers when they're both plugged-in, so I'm unable to freely choose between one of them. However, if I use the default Windows 10 audio drivers, I am able to do so... That is really weird to me. (In reply to gbr from comment #11) > Thanks for pointing the directions, I'll definitely open a ticket there, but > what title and description do you think I should choose? I'm not sure > exactly what this bug is and I wouldn't want to "guess" a title/description > for it, since I could be misleading... The title could be "ALC662: the Line playback volume and switch don't do anything". Here's some content for the full description (if you copy it as is, it's best to attribute the text to me, since there's some statements in first person): With speakers plugged in to the green connector on the back of ASRock B75M-DGS R2.0 motherboard[1] (with Realtek ALC662 audio codec), the speaker audio can't be muted without muting also front panel headphone output. The mixer has playback volume and switch elements named "Line", which I would expect to control the speaker audio, but those mixer elements don't seem to be doing anything. [1] http://www.asrock.com/mb/Intel/B75M-DGS%20R2.0/ You can also add a link to this bug. Let me know when you've filed the bug, I'll subscribe to it. > Oh my God, thank you soooo much! It worked perfectly!!! Pavucontrol still > shows "Line Out" as "unplugged", but I can switch to it and it will still > work as expected. Thanks again! You can fix the "unplugged" issue by removing this from analog-output-lineout.conf: [Jack Headphone] state.plugged = no state.unplugged = unknown [Jack Front Headphone] state.plugged = no state.unplugged = unknown (In reply to Tanu Kaskinen from comment #13) > You can also add a link to this bug. Let me know when you've filed the bug, > I'll subscribe to it. Here's the ticket: https://bugzilla.kernel.org/show_bug.cgi?id=199187 > > You can fix the "unplugged" issue by removing this from > analog-output-lineout.conf: > > [Jack Headphone] > state.plugged = no > state.unplugged = unknown > > [Jack Front Headphone] > state.plugged = no > state.unplugged = unknown Perfect! Thank you so much for everything. -- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/256. |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.