Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Linux linux 3.0.0-14-generic #23-Ubuntu SMP Mon Nov 21 20:28:43 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux

Oneiric Ocelot

I have an Asus Xonar DG sound card which has several outputs to choose from.

Sometimes I want to use the regular speaker output and have it go through my speakers but other times I'd like to be able to use the front panel audio port for my headphones.

I tried switching the output port in both pavucontrol and the built in Ubuntu sound panel, but as soon as an audio stream begins playing the port will change from "headphones" back to "speaker" and the audio continues coming out of my speakers.

So I dropped down to pacmd and tried to change it...

>>> list-sinks
3 sink(s) available.
    index: 0
    name: <alsa_output.pci-0000_03_00.1.hdmi-stereo>
    driver: <module-alsa-card.c>
    flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: SUSPENDED
    suspend cause: IDLE 
    priority: 9050
    volume: 0: 100% 1: 100%
            0: -0.00 dB 1: -0.00 dB
            balance 0.00
    base volume: 100%
                 0.00 dB
    volume steps: 65537
    muted: no
    current latency: 0.00 ms
    max request: 0 KiB
    max rewind: 0 KiB
    monitor source: 0
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 0
    linked by: 0
    configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
    card: 0 <alsa_card.pci-0000_03_00.1>
    module: 4
    properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "HDMI 0"
        alsa.id = "HDMI 0"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "3"
        alsa.card = "2"
        alsa.card_name = "HD-Audio Generic"
        alsa.long_card_name = "HD-Audio Generic at 0xfbbfc000 irq 78"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:03:00.1"
        sysfs.path = "/devices/pci0000:00/0000:00:03.0/0000:03:00.1/sound/card2"
        device.bus = "pci"
        device.vendor.id = "1002"
        device.vendor.name = "ATI Technologies Inc"
        device.product.id = "aa50"
        device.product.name = "Cypress HDMI Audio [Radeon HD 5800 Series]"
        device.string = "hdmi:2"
        device.buffering.buffer_size = "352768"
        device.buffering.fragment_size = "176384"
        device.access_mode = "mmap+timer"
        device.profile.name = "hdmi-stereo"
        device.profile.description = "Digital Stereo (HDMI)"
        device.description = "Cypress HDMI Audio [Radeon HD 5800 Series] Digital Stereo (HDMI)"
        alsa.mixer_name = "ATI R6xx HDMI"
        alsa.components = "HDA:1002aa01,00aa0100,00100200"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    ports:
        HDMI: HDMI (priority 0, available: no)
    active port: <HDMI>
    index: 1
    name: <alsa_output.pci-0000_00_1b.0.analog-stereo>
    driver: <module-alsa-card.c>
    flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: SUSPENDED
    suspend cause: IDLE 
    priority: 9959
    volume: 0: 101% 1: 101%
            0: 0.25 dB 1: 0.25 dB
            balance 0.00
    base volume: 100%
                 0.00 dB
    volume steps: 65537
    muted: no
    current latency: 0.00 ms
    max request: 0 KiB
    max rewind: 0 KiB
    monitor source: 1
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 0
    linked by: 0
    configured latency: 0.00 ms; range is 0.50 .. 1999.82 ms
    card: 1 <alsa_card.pci-0000_00_1b.0>
    module: 5
    properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "ALC889 Analog"
        alsa.id = "ALC889 Analog"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "1"
        alsa.card_name = "HDA Intel"
        alsa.long_card_name = "HDA Intel at 0xfb8f8000 irq 77"
        alsa.driver_name = "snd_hda_intel"
        device.bus_path = "pci-0000:00:1b.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1b.0/sound/card1"
        device.bus = "pci"
        device.vendor.id = "8086"
        device.vendor.name = "Intel Corporation"
        device.product.id = "3a3e"
        device.product.name = "82801JI (ICH10 Family) HD Audio Controller"
        device.form_factor = "internal"
        device.string = "front:1"
        device.buffering.buffer_size = "352768"
        device.buffering.fragment_size = "176384"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Analog Stereo"
        device.description = "Internal Audio Analog Stereo"
        alsa.mixer_name = "Realtek ALC889"
        alsa.components = "HDA:10ec0889,104383c0,00100004"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    ports:
        analog-output: Analog Output (priority 9900, available: unknown)
        analog-output-headphones: Analog Headphones (priority 9000, available: no)
    active port: <analog-output-headphones>
  * index: 2
    name: <alsa_output.pci-0000_08_01.0.analog-stereo>
    driver: <module-alsa-card.c>
    flags: HARDWARE DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
    state: SUSPENDED
    suspend cause: IDLE 
    priority: 9059
    volume: 0: 100% 1: 100%
            0: 0.00 dB 1: 0.00 dB
            balance 0.00
    base volume: 100%
                 0.00 dB
    volume steps: 65537
    muted: no
    current latency: 0.00 ms
    max request: 0 KiB
    max rewind: 0 KiB
    monitor source: 3
    sample spec: s16le 2ch 44100Hz
    channel map: front-left,front-right
                 Stereo
    used by: 0
    linked by: 0
    configured latency: 0.00 ms; range is 36.00 .. 2000.00 ms
    card: 2 <alsa_card.pci-0000_08_01.0>
    module: 6
    properties:
        alsa.resolution_bits = "16"
        device.api = "alsa"
        device.class = "sound"
        alsa.class = "generic"
        alsa.subclass = "generic-mix"
        alsa.name = "Multichannel"
        alsa.id = "Multichannel"
        alsa.subdevice = "0"
        alsa.subdevice_name = "subdevice #0"
        alsa.device = "0"
        alsa.card = "0"
        alsa.card_name = "Xonar DG"
        alsa.long_card_name = "C-Media Oxygen HD Audio at 0xe800, irq 17"
        alsa.driver_name = "snd_oxygen"
        device.bus_path = "pci-0000:08:01.0"
        sysfs.path = "/devices/pci0000:00/0000:00:1e.0/0000:08:01.0/sound/card0"
        device.bus = "pci"
        device.vendor.id = "13f6"
        device.vendor.name = "C-Media Electronics Inc"
        device.product.id = "8788"
        device.product.name = "CMI8788 [Oxygen HD Audio]"
        device.string = "front:0"
        device.buffering.buffer_size = "352800"
        device.buffering.fragment_size = "352800"
        device.access_mode = "mmap+timer"
        device.profile.name = "analog-stereo"
        device.profile.description = "Analog Stereo"
        device.description = "CMI8788 [Oxygen HD Audio] Analog Stereo"
        alsa.mixer_name = "CMI8786"
        alsa.components = "CS4245 CMI8786"
        module-udev-detect.discovered = "1"
        device.icon_name = "audio-card-pci"
    ports:
        analog-output;output-speaker: Analog Output / Speaker (priority 9910, available: unknown)
        analog-output;output-headphones-1: Analog Output / Headphones 1 (priority 9909, available: unknown)
        analog-output;output-headphones-2: Analog Output / Headphones 2 (priority 9908, available: unknown)
    active port: <analog-output;output-speaker>
>>> set-sink-port 2 analog-output;output-headphones-1
Failed to set sink port to 'analog-output;output-headphones-1'.

Booo. Any thoughts?

Nothing appears in /var/log/dmesg or /var/log/syslog, I'm not sure where else I should be looking...

share|improve this question
1  
Have you been able to get this to work at all? I've been tinkering for a time with no success. Filed as 919809. –  Jacob Peddicord Jan 21 '12 at 20:36
    
Nope, no luck. Let me know if I can help you debug at all. –  ashgromnies Jan 23 '12 at 18:49

1 Answer 1

From output of your list-sinks we can see that by default your headphone sink has index 1, your speakers sink has index 2 (HDMI is 0). Provided you have a default setup for PulseAudio you should be able to switch between these two sinks by issuing:

pacmd set-default-sink 1 # for headphones
pacmd set-default-sink 2 # for speakers

See also this answer for changing sink output while an active stream is playing and how to disable stream device restore.

share|improve this answer
    
Sink index 1 is actually my motherboard's onboard sound. Sink index 2 is my Xonar DG sound card. As you can see, sink index 2 has multiple ports(speaker, headphones, etc.) and I want to select the headphone port on sink index 2. –  ashgromnies Dec 15 '11 at 15:49
    
@ashgromnies: Sorry my bad I was reading your Q to fast. Just guessing: try with a) the full sink namealsa_output.pci-0000_08_01.0.analog-stereo instead of index, and b) try if it works when called from your default.pa. –  Takkat Dec 16 '11 at 10:42
    
No go. Googling around for the specific error message I'm receiving only shows me results from the source code as well. I can probably triage why it's failing in the code but I'm hoping someone has an idea. –  ashgromnies Dec 16 '11 at 23:55
    
@ashgromnies: I assume you are able to change the port for your sink #1 - I can't test this because I only have one sound card installed. I may also be an issue with that particular card (available: unknown). –  Takkat Dec 17 '11 at 17:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.