You are not logged in.

#1 2017-04-17 01:18:21

squilter
Member
Registered: 2015-10-05
Posts: 9

[Solved] Volume control incorrect after connecting bluetooth speaker

After following the bluetooth instructions in the wiki (using pulseaudio-bluetooth), my bluetooth speaker now connects automatically when I turn it on, as I wanted it to. Pulseaudio automatically sets is as the active device, which is good. The problem is that when I use the volume control buttons on my keyboard, gnome decides to adjust the volume to my headphones, where no audio is coming from. Gnome even says "headphones" under the volume bar as I adjust it. In order to adjust the volume, I have to go into gnome settings. Gnome seems to think that headphones are active, even though they are not. So I click on my bluetooth device to set it as the output device (even though audio is already coming out of there), and then gnome recognizes that it is active, and the volume control works properly. How can I make gnome automatically recognize that pulseaudio has changed to a new device? It is tedious to have to go into the settings every time I turn on my bluetooth headset. Thanks.

Last edited by squilter (2017-04-20 17:57:52)

Offline

#2 2017-04-17 05:29:14

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

It may not be a GNOME's issue. Pulseaudio may not have set your bluetooth speaker as the default sink (active device in your word) when it connects (again). It could be the fact that certain stream(s) are routed to the non-default bluetooth sink that makes you hear sound coming out from it.

Would you mind doing the following next time you experience the issue, before you go to GNOME setting and switch the output device:

pacmd list-sinks |& curl -F c=@- https://ptpb.pw
pacmd list-sink-inputs |& curl -F c=@- https://ptpb.pw

and report back with the two ptpb paste links?

Offline

#3 2017-04-17 14:28:22

squilter
Member
Registered: 2015-10-05
Posts: 9

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

Here they are:

https://ptpb.pw/nDSG

The first sink is my headphones, where I normal expect sound. The second sink is something I never use. The third sink is my bluetooth speaker.

https://ptpb.pw/BFIc

Both Firefox and Spotify are playing out of the bluetooth speaker.

Offline

#4 2017-04-18 06:14:28

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

  * index: 2
	name: <alsa_output.pci-0000_00_1b.0.analog-stereo>

See the asterisk (*) before "index"? It indicates the default sink, which is not the bluetooth speaker but analog audio (headphone jack).

And as expected, your streams somehow got fixed to the bluetooth sink even when it is not the default:

sink: 13 <bluez_sink.C7_38_5D_84_72_D8.a2dp_sink>

This might be because, when you change the output device in gnome and/or pavucontrol, it explicitly re-routes existing streams to the new default sink as well. The re-routing might have caused a "preferred" sink set for those streams in the stream restore database, so they play through the sink as long as it exists when you start the programs, no matter if it is currently the default. (While streams that have never been re-routed will play through the default.)

pacmd set-default-sink does not re-route existing streams automatically, so they sticks with the old default before restarted, and plays through the new default after restarted; while you can explicitly re-route each of them with pacmd move-sink-input, which causes the aforementioned scenario:

https://ptpb.pw/EMeT

You can see the never-moved sox (`play`) stream plays through the current default sink (internal audio) while the moved mpv stream sticks with its "preferred" sink (usb audio). Here is a detailed final capture (pacmd list-sink-inputs):

https://ptpb.pw/DEge

Last edited by tom.ty89 (2017-04-18 14:15:42)

Offline

#5 2017-04-18 10:31:55

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

The switch on connect module is probably what you need:

https://www.freedesktop.org/wiki/Softwa … #index65h3

Load it in default.pa. You might need to explicitly set the only_from_unavailable parameter to false to make it work as desired.

Last edited by tom.ty89 (2017-04-18 11:21:58)

Offline

#6 2017-04-18 15:33:49

squilter
Member
Registered: 2015-10-05
Posts: 9

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

The switch_on_connect module works exactly as I hoped it would. Thanks for the help!

Offline

#7 2017-04-18 21:12:05

squilter
Member
Registered: 2015-10-05
Posts: 9

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

Now I've had a few hours with it, and it hasn't exactly fixed the problem. Whenever I turn on my bluetooth speaker, it succesfully connects, and immediately becomes the default device. The problem is that sometimes spotify or firefox or chromium will choose to continue playing the music through my headphones anyways. This is a bit odd, since the documentation for module-switch-on-connect says that it "will move all currently running streams to the new sink/source".

Offline

#8 2017-04-19 04:05:37

tom.ty89
Member
Registered: 2012-11-15
Posts: 897

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

Try this: locate the following line in default.pa:

load-module module-stream-restore

and change it into:

load-module module-stream-restore restore_device=false

Offline

#9 2017-04-20 15:15:22

squilter
Member
Registered: 2015-10-05
Posts: 9

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

Yes, that did it. Thank you.

Offline

#10 2017-04-20 16:39:38

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,845
Website

Re: [Solved] Volume control incorrect after connecting bluetooth speaker

Please remember to mark your thread as solved.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB