You are not logged in.

#1 2013-10-04 15:27:28

Grima
Member
Registered: 2011-09-02
Posts: 58

[SOLVED] How does "gnome sound center" assign streams to new sink?

I recently bought a usb amp/dac, and I would like to easily switch between using my default speakers (onboard audio) and the usb amp/dac.

I'm using PulseAudio and found out that I can switch between sinks and move audio streams with the utility "pactl". However, I cannot move audio streams that are not playing (e.g. a paused YouTube clip), which results in that some applications use my onboard audio and some the usb amp/dac. Very annoying.

The odd thing is that when I tried changing the active soundcard in gnome control center, every application uses the new settings - regardless if the audio stream was active or not! What does the sound settings of gnome control center do to achieve this?

This is what I'm currently doing:

#!/bin/bash

[...parsing and stuff...]

pactl set-default-sink "$selected_sink_value"

[...some controls and volume adjustments...]

pactl list short sink-inputs | while read stream; do
    stream_id=$(echo $stream | cut '-d ' -f1)
    echo "Moving stream id $stream_id"
    pactl move-sink-input "$stream_id" "$selected_sink_value"
done

Last edited by Grima (2013-11-17 19:12:07)

Offline

#2 2013-10-04 15:58:10

Jodell
Member
Registered: 2009-10-09
Posts: 285

Re: [SOLVED] How does "gnome sound center" assign streams to new sink?

Pavucontrol gives the same functionality as the Gnome software. It is a DE agnostic solution as well.

Offline

#3 2013-10-04 16:32:02

Grima
Member
Registered: 2011-09-02
Posts: 58

Re: [SOLVED] How does "gnome sound center" assign streams to new sink?

Jodell wrote:

Pavucontrol gives the same functionality as the Gnome software. It is a DE agnostic solution as well.

Oops! I forgot to add that I wish to use CLI application(s) to achieve this. I want to automate this; that's why I'm experimenting with pactl.

Offline

#4 2013-11-17 19:11:02

Grima
Member
Registered: 2011-09-02
Posts: 58

Re: [SOLVED] How does "gnome sound center" assign streams to new sink?

Finally found a solution to this problem a few days ago (by accident too!).

The reason why the sound settings of gnome-control-panel works is that it modifies PulseAudio's "stream-restore database". I don't know how one would do that by hand, but it sounds complex. Instead, I edited /etc/pulse/default.pa and added "restore_device=false" to the line loading "module-stream-restore". Now every single audio stream plays via the default sink, even if I use pactl.

Thought I might as well post a solution since there seems to be many people asking the same thing. Maybe this'll help someone?

Offline

Board footer

Powered by FluxBB