3

I have a headset connected to the front panel and speakers connected to my rear panel (stationary computer). I want to be able to play audio either from the speakers or the headset, but none at the same time. I'm using Ubuntu 15.10 (Wily). Both the headset and the speakers are analog.

I know this should work in some way, I have found posts like this one: thomasa88.blogspot.se/2008/11/pulseaudio-and-speakersheadphones.html
but I can't get it to work properly, maybe because the post is very outdated.

My sound card: Realtek ALC892 (built into motherboard)

Could someone please tell me what I need to do? If you need more information from me, just ask!


Update (01/17/2016)

The output of amixer:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 45 [70%] [-19.00dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 64 [100%] [0.00dB] [on]
  Front Right: Playback 64 [100%] [0.00dB] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 255
  Mono:
  Front Left: Playback 254 [100%] [-0.20dB]
  Front Right: Playback 254 [100%] [-0.20dB]
Simple mixer control 'Front',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 64 [100%] [0.00dB] [on]
  Front Right: Playback 64 [100%] [0.00dB] [on]
Simple mixer control 'Front Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Front Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Surround',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 0 [0%] [-64.00dB] [off]
  Front Right: Playback 0 [0%] [-64.00dB] [off]
Simple mixer control 'Center',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 0 [0%] [-64.00dB] [off]
Simple mixer control 'LFE',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 64
  Mono: Playback 0 [0%] [-64.00dB] [off]
Simple mixer control 'Side',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 64
  Mono:
  Front Left: Playback 0 [0%] [-64.00dB] [off]
  Front Right: Playback 0 [0%] [-64.00dB] [off]
Simple mixer control 'Line',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Line Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'IEC958 Default PCM',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 46
  Front Left: Capture 46 [100%] [30.00dB] [on]
  Front Right: Capture 46 [100%] [30.00dB] [on]
Simple mixer control 'Capture',1
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 46
  Front Left: Capture 0 [0%] [-16.00dB] [off]
  Front Right: Capture 0 [0%] [-16.00dB] [off]
Simple mixer control 'Input Source',0
  Capabilities: cenum
  Items: 'Front Mic' 'Rear Mic' 'Line'
  Item0: 'Front Mic'
Simple mixer control 'Input Source',1
  Capabilities: cenum
  Items: 'Front Mic' 'Rear Mic' 'Line'
  Item0: 'Front Mic'
Simple mixer control 'Rear Mic',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Rear Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]

I'm guessing it should be capable because it worked perfectly fine in Windows 7 with the same setup, though I'm very new to Ubuntu.


Update (01/20/2016)

Result of alsamixer when sound output is set to "Headphones".

Result of alsamixer when sound output is set to "Line Out".

There is no automatic muting whatsoever when (un)plugging any of the devices in question.

In alsamixer I can mute the "Headphone" channel independently of everything else. However, to mute the speakers I need to mute the "Front" channel which I can't mute without muting everything else as well.

The best I can do, is turning down the "Front" channel's volume to 0, the problem is that the speakers still play sound (although low it is still there, and not low enough to be negligible).

Just to be clear:
I want to be able to mute the headphones and the speakers independently of each other and not listen to both at the same time, how can I do that?

user_
  • 49
  • This depends on the hardware's capabilities. Show the output of amixer scontents. – CL. Jan 16 '16 at 18:20
  • Does the "Master" control affect the headphones? Is there some automatic muting when you (un)plug the headphones? – CL. Jan 18 '16 at 07:43
  • @CL. Yes, the "Master" control affect the headphones, as well as the speakers. There is no automatic muting whatsoever. I updated the post with some pictures. – user_ Jan 20 '16 at 00:57
  • Apparently, your hardware cannot mute the speakers independently. – CL. Jan 20 '16 at 07:36
  • @CL. But it should be possible through creating a virtual sound card. That way you can split the front/rear audio ports into two different audio sinks. How do I do this in Ubuntu 15.10? – user_ Jan 20 '16 at 14:39

1 Answers1

1

This usually works out of the box without any modifications. Ideally, if your front panel supports jack detection it should work automatically like on a laptop, where audio gets routed to headphones when connected and to speakers when headphones are disconnected. You can control the setting manually in pavucontrol.

enter image description here

The method described in the link through the playback tab (also described here) is intended to move streams from one soundcard to another. Setting up a virtual soundcard with remapped channels looks like over complicating things a bit.


Edit: I just checked on my desktop machine — where I don't use onboard sound very often — with a Haswell board and a ALC892 chip, jack detection works and switches automatically to the front panel when a headphone is connected in 14.04. Check that your front panel has an HD audio connector (1, 2).

LiveWireBT
  • 28,763
  • Doesn't help, look updated post for more information about my particular problem, thanks anyway! – user_ Jan 20 '16 at 00:57
  • What I understood was that you wanted to play audio either from speakers or headphones, switching the output like above does that in the default setup and you can simply mute the active output as usual. You can also build yourself one or more scripts that call pacmd with the corresponding parameters and build a launcher. – LiveWireBT Jan 20 '16 at 01:23