You are not logged in.

#1 2020-12-13 14:49:56

Awlex
Member
Registered: 2018-08-06
Posts: 17

[SOLVED] Disable sound-card profiles for pulseaudio

I have 3 monitors and only one is connected to the sound system, so I want this monitor to be the default output, which I was able to achieve by setting 

load-module module-alsa-sink device=hw:0,6

In my default.pa file, but whenever I exit sleep it uses the wrong profile again. Is it possible to disable the profile or maybe prevent it from choosing the wrong profile?

Last edited by Awlex (2020-12-17 19:28:39)

Offline

#2 2020-12-13 14:59:47

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [SOLVED] Disable sound-card profiles for pulseaudio

Try adding a script to set the module parameters under /lib/systemd/system-sleep/.

For example:

#!/bin/sh
case "$1" in
   post) pactl load-module module-alsa-sink device=hw:0,6;;
esac

(Untested.)


Jin, Jîyan, Azadî

Offline

#3 2020-12-13 16:37:26

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,062

Re: [SOLVED] Disable sound-card profiles for pulseaudio

It would be better if you used the actual profile instead of allocating a new sink that's completely outside of the profile logic.

Check through pavucontrols config tab or

pacmd list-cards

and select the proper preallocated profile, that should generally ensure that the proper profile is remembered.

Offline

#4 2020-12-13 17:25:22

Awlex
Member
Registered: 2018-08-06
Posts: 17

Re: [SOLVED] Disable sound-card profiles for pulseaudio

Head_on_a_Stick wrote:

Try adding a script to set the module parameters under /lib/systemd/system-sleep/.

For example:

#!/bin/sh
case "$1" in
   post) pactl load-module module-alsa-sink device=hw:0,6;;
esac

(Untested.)

Didn't work, unfortunatelly.

V1del wrote:

It would be better if you used the actual profile instead of allocating a new sink that's completely outside of the profile logic.

Check through pavucontrols config tab or

pacmd list-cards

and select the proper preallocated profile, that should generally ensure that the proper profile is remembered.

I always use pavucontrol or pactl to set the profile, but always end up with the wrong profile after a sleep/reboot.

Offline

#5 2020-12-13 18:53:00

Head_on_a_Stick
Member
From: The Wirral
Registered: 2014-02-20
Posts: 8,999
Website

Re: [SOLVED] Disable sound-card profiles for pulseaudio

Awlex wrote:

Didn't work

https://bbs.archlinux.org/viewtopic.php?id=57855

Check the journal to see why it's failing. Does the pactl(1) command work if you run it in isolation?

Having said that I would defer to V1del on this one, they really know their audio (and pretty much everything else).


Jin, Jîyan, Azadî

Offline

#6 2020-12-13 19:21:52

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,062

Re: [SOLVED] Disable sound-card profiles for pulseaudio

Well are you actually setting the profile or selecting the sink you've allocated?

In any case what's likely to help is unloading module-switch-on-port-available (... and uncommenting/removing it from your /etc/pulse/default.pa) if you really want to disable all auto-detected profiles you could also just comment module-udev-detect in that same file and use your allocated standalone sink.

For HoaS' suggestion to work you'd need to do some more in that script (... I don't think your sink is inherently unloaded and you'd instead need to set it as the default again or so) but you need to provide access to your user's DBUS session  to the pactl command, so you'd rather do something like

#!/bin/sh
case "$1" in
   post) sudo -u $USER DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$UID/bus pactl set-default-sink alsa_output_hw:0.6 ;;
esac

replace $USER and $UID as appropriate for your situation, as well as the sink name according to the relevant outputs.

Last edited by V1del (2020-12-14 15:06:05)

Offline

#7 2020-12-17 19:28:18

Awlex
Member
Registered: 2018-08-06
Posts: 17

Re: [SOLVED] Disable sound-card profiles for pulseaudio

Sorry for the delayed response I tried a couple of things using the with the script you suggested, but I don't think it ever got executed.
Code used to send device trigger sleep

sleep 1; xset dpms force off

So I tried a different aproach and found this answer on how to prevent the switch after sleep, which seems to work for me. Note that I modified ~/.config/pulse/default.pa instead of the mentioned file. Thank you for your help!

Offline

Board footer

Powered by FluxBB