Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] per-app volume sliders crash on virtual sinks #327

Closed
baitmooth opened this issue Oct 11, 2024 · 12 comments
Closed

[BUG] per-app volume sliders crash on virtual sinks #327

baitmooth opened this issue Oct 11, 2024 · 12 comments

Comments

@baitmooth
Copy link

Describe the bug
I'd love to use the 'per app volume', but the slider never appears (traceback below)

To Reproduce

  1. check per-app volume
  2. start one or more audio streams
  3. open menu

Expected behavior
see the individual streams

Additional context and screenshots

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 585, in on_window_show
    self.create_per_app_sliders()
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 595, in create_per_app_sliders
    props = sink_inputs[inp]["Properties"]
            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'Properties'
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 159, in update_brightness
    self.popup_window.refresh()
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 684, in refresh
    props = sink_inputs[inp]["Properties"]
            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'Properties'
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 684, in refresh
    props = sink_inputs[inp]["Properties"]
            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'Properties'
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 159, in update_brightness
    self.popup_window.refresh()
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 684, in refresh
    props = sink_inputs[inp]["Properties"]
            ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
KeyError: 'Properties'

swappy-20241011_150311
sway_screenshot

Since i guess that this works for others, what are the dependencies for this?

@nwg-piotr
Copy link
Owner

nwg-piotr commented Oct 11, 2024

Is the pactl command available? Could you show me the pactl list sink-inputs command output?

@baitmooth
Copy link
Author

baitmooth commented Oct 12, 2024

pactl list sink-inputs
Sorry it is in german…

Ziel-Eingabe #14
	Treiber: module-combine-sink.c
	Besitzer-Modul: 14
	Client: k. A.
	Ziel: 0
	Abtastwert-Angabe: s16le 2ch 44100Hz
	Kanalzuordnung: front-left,front-right
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Unterbrochen: nein
	Stumm: nein
	Lautstärke: front-left: 65536 / 100% / 0,00 dB,   front-right: 65536 / 100% / 0,00 dB
	        Verteilung 0,00
	Pufferlatenz: 181 usec
	Ziel-Latenz: 199117 usec
	Resample-Methode: speex-float-1
	Eigenschaften:
		media.name = "Simultaneous output on Internes Audio Analog Stereo"
		media.role = "filter"
		module-stream-restore.id = "sink-input-by-media-role:filter"

Ziel-Eingabe #15
	Treiber: protocol-native.c
	Besitzer-Modul: 12
	Client: 18793
	Ziel: 1
	Abtastwert-Angabe: s16le 2ch 44100Hz
	Kanalzuordnung: front-left,front-right
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Unterbrochen: nein
	Stumm: nein
	Lautstärke: front-left: 65133 /  99% / -0,16 dB,   front-right: 65133 /  99% / -0,16 dB
	        Verteilung 0,00
	Pufferlatenz: 139206 usec
	Ziel-Latenz: 199276 usec
	Resample-Methode: k. A.
	Eigenschaften:
		media.name = "Pulse Audio Output"
		application.name = "Music Player Daemon"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "35"
		media.role = "music"
		application.icon_name = "mpd"
		application.process.id = "201484"
		application.process.user = "pan"
		application.process.host = "oxylos"
		application.process.binary = "mpd"
		application.language = "C"
		window.x11.display = ":0"
		application.process.machine_id = "23442cfc25cc46a9bf46d48d165c486d"
		module-stream-restore.id = "sink-input-by-media-role:music"```

@nwg-piotr
Copy link
Owner

nwg-piotr commented Oct 12, 2024

LOL, I had no idea that pactl would give localized output. Surely my parser makes no use of German values. I'll try to fix it, but won't release another version tonight, in order not to infuriate packagers.

nwg-piotr added a commit that referenced this issue Oct 12, 2024
@baitmooth
Copy link
Author

This happens now in terminal

KeyError: 'application.name'
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 159, in update_brightness
    self.popup_window.refresh()
  File "/usr/lib/python3.12/site-packages/nwg_panel/modules/controls.py", line 694, in refresh
    scale = PerAppSlider(inp, vol, icon_name, props["application.name"], props["media.name"])

Still no per-app volume :(

@nwg-piotr
Copy link
Owner

May I see the output of LC_ALL=C pactl list sink-inputs?

@nwg-piotr
Copy link
Owner

nwg-piotr commented Oct 15, 2024

I've just set up a testing environment in German, on my old laptop. Hoped to nail the bug here, but everything works as expected, especially per-app sliders. Also, the pactl output is in English.

Maybe pactl provided with pulseaudio is different from the one used by pipewire? No, I've just checked. No more ideas at the moment.

grafik

@baitmooth
Copy link
Author

Hej. You are right it is working
working
unless i activate pulseaudios virtual sink for simultanious output.

@nwg-piotr
Copy link
Owner

Well, I don't know what your pactl output looks like in English, and also I know nothing about virtual sinks. That means I have no fix for your issue.

@baitmooth
Copy link
Author

Well, I don't know what your pactl output looks like in English

Totally forgot that.

without simultaneous output

LC_ALL=C pactl list sink-inputs
Sink Input #3
	Driver: protocol-native.c
	Owner Module: 12
	Client: 589
	Sink: 0
	Sample Specification: s16le 2ch 44100Hz
	Channel Map: front-left,front-right
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Corked: no
	Mute: no
	Volume: front-left: 63569 /  97% / -0.79 dB,   front-right: 63569 /  97% / -0.79 dB
	        balance 0.00
	Buffer Latency: 16326 usec
	Sink Latency: 4575 usec
	Resample method: n/a
	Properties:
		media.name = "Audio Stream"
		application.name = "python3.12"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "35"
		application.process.id = "3325"
		application.process.user = "pan"
		application.process.host = "oxylos"
		application.process.binary = "python3.12"
		application.language = "de_DE.UTF-8"
		window.x11.display = ":0"
		application.process.machine_id = "23442cfc25cc46a9bf46d48d165c486d"
		application.process.session_id = "3"
		module-stream-restore.id = "sink-input-by-application-name:python3.12"

Sink Input #17
	Driver: protocol-native.c
	Owner Module: 12
	Client: 352
	Sink: 0
	Sample Specification: s16le 2ch 44100Hz
	Channel Map: front-left,front-right
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Corked: no
	Mute: no
	Volume: front-left: 100270 / 153% / 11.08 dB,   front-right: 100270 / 153% / 11.08 dB
	        balance 0.00
	Buffer Latency: 244444 usec
	Sink Latency: 4541 usec
	Resample method: n/a
	Properties:
		media.name = "Pulse Audio Output"
		application.name = "Music Player Daemon"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "35"
		media.role = "music"
		application.icon_name = "mpd"
		application.process.id = "1495"
		application.process.user = "pan"
		application.process.host = "oxylos"
		application.process.binary = "mpd"
		application.language = "C"
		application.process.machine_id = "23442cfc25cc46a9bf46d48d165c486d"
		module-stream-restore.id = "sink-input-by-media-role:music"

with simultaneous output

LC_ALL=C pactl list sink-inputs
Sink Input #17
	Driver: protocol-native.c
	Owner Module: 12
	Client: 352
	Sink: 7
	Sample Specification: s16le 2ch 44100Hz
	Channel Map: front-left,front-right
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Corked: no
	Mute: no
	Volume: front-left: 100270 / 153% / 11.08 dB,   front-right: 100270 / 153% / 11.08 dB
	        balance 0.00
	Buffer Latency: 238798 usec
	Sink Latency: 12643 usec
	Resample method: n/a
	Properties:
		media.name = "Pulse Audio Output"
		application.name = "Music Player Daemon"
		native-protocol.peer = "UNIX socket client"
		native-protocol.version = "35"
		media.role = "music"
		application.icon_name = "mpd"
		application.process.id = "1495"
		application.process.user = "pan"
		application.process.host = "oxylos"
		application.process.binary = "mpd"
		application.language = "C"
		application.process.machine_id = "23442cfc25cc46a9bf46d48d165c486d"
		module-stream-restore.id = "sink-input-by-media-role:music"

Sink Input #18
	Driver: module-combine-sink.c
	Owner Module: 29
	Client: n/a
	Sink: 0
	Sample Specification: s16le 2ch 44100Hz
	Channel Map: front-left,front-right
	Format: pcm, format.sample_format = "\"s16le\""  format.rate = "44100"  format.channels = "2"  format.channel_map = "\"front-left,front-right\""
	Corked: no
	Mute: no
	Volume: front-left: 65536 / 100% / 0.00 dB,   front-right: 65536 / 100% / 0.00 dB
	        balance 0.00
	Buffer Latency: 181 usec
	Sink Latency: 199723 usec
	Resample method: speex-float-1
	Properties:
		media.name = "Simultaneous output on Internes Audio Analog Stereo"
		media.role = "filter"
		module-stream-restore.id = "sink-input-by-media-role:filter"

At this point I would say let's change the title of the bug first. Since it is related to the virtual sink.

To me it looks like You check application name per sink. And virtual one does not have one. I guess if there would be a check for either Driver: module-combine-sink.c (which should be same on all systems), or media.role = "filter" (which might differ)?

@nwg-piotr
Copy link
Owner

nwg-piotr commented Oct 16, 2024

What if I'd just skip sinks that have no application.name? Do you need to see volume sliders for them?

@baitmooth
Copy link
Author

Skipping this would be okay, since I can control it with the other output selection slider.

@nwg-piotr
Copy link
Owner

OK, I'll do so. This is the simplest solution.

nwg-piotr added a commit that referenced this issue Oct 16, 2024
@nwg-piotr nwg-piotr changed the title [BUG] can't see per-app volume [BUG] per-app volume crash on virtual sinks Oct 16, 2024
@nwg-piotr nwg-piotr changed the title [BUG] per-app volume crash on virtual sinks [BUG] per-app volume sliders crash on virtual sinks Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants