yktoo / indicator-sound-switcher

Sound input/output selector indicator for Linux
https://yktoo.com/en/software/sound-switcher-indicator/
GNU General Public License v3.0
367 stars 29 forks source link

Add support for network sinks and sources #48

Closed ngiraldo closed 5 years ago

ngiraldo commented 7 years ago

I have setup a remote pulseaudio server, and added a pulseaudio tunnel in the local client.

The tunnel works and audio is emitted in the remote server.

I can select the tunnel as an output in sound settings "Tunnel to 192.168.0.20", but no selected or selectable entry appears in the indicator.

yktoo commented 7 years ago

An interesting use case. Do you mind attaching the output of indicator-sound-switcher -vv (also interesting to see messages that are logged when you switch to the tunnel via Sound Settings)?

ngiraldo commented 7 years ago
INF Configuration file /home/nicolay/.config/indicator-sound-switcher.json not found, falling back to defaults
INF Context connected
DEB   + Card[0] added: `alsa_card.pci-0000_00_03.0`
DEB     + Card profile added: `off` (`Off`), 0 sinks, 0 sources, priority: 0
DEB     + Card profile added: `output:hdmi-stereo-extra2` (`Digital Stereo (HDMI 3) Output`), 1 sinks, 0 sources, priority: 200
DEB     + Card profile added: `output:hdmi-surround` (`Digital Surround 5.1 (HDMI) Output`), 1 sinks, 0 sources, priority: 3300 -- Active
DEB     + Card profile added: `output:hdmi-stereo-extra1` (`Digital Stereo (HDMI 2) Output`), 1 sinks, 0 sources, priority: 200
DEB     + Card profile added: `output:hdmi-surround-extra1` (`Digital Surround 5.1 (HDMI 2) Output`), 1 sinks, 0 sources, priority: 3100
DEB     + Card profile added: `output:hdmi-stereo` (`Digital Stereo (HDMI) Output`), 1 sinks, 0 sources, priority: 400
DEB     + Card profile added: `output:hdmi-surround71-extra1` (`Digital Surround 7.1 (HDMI 2) Output`), 1 sinks, 0 sources, priority: 100
DEB     + Card profile added: `output:hdmi-surround-extra2` (`Digital Surround 5.1 (HDMI 3) Output`), 1 sinks, 0 sources, priority: 3100
DEB     + Card profile added: `output:hdmi-surround71` (`Digital Surround 7.1 (HDMI) Output`), 1 sinks, 0 sources, priority: 300
DEB     + Card profile added: `output:hdmi-surround71-extra2` (`Digital Surround 7.1 (HDMI 3) Output`), 1 sinks, 0 sources, priority: 100
DEB     + Card port added: `hdmi-output-2` (`HDMI / DisplayPort 3`); priority: 5700; direction: 1; available: No
DEB       . Supported profile: `output:hdmi-stereo-extra2`
DEB       . Supported profile: `output:hdmi-surround-extra2`
DEB       . Supported profile: `output:hdmi-surround71-extra2`
DEB     + Card port added: `hdmi-output-1` (`HDMI / DisplayPort 2`); priority: 5800; direction: 1; available: No
DEB       . Supported profile: `output:hdmi-stereo-extra1`
DEB       . Supported profile: `output:hdmi-surround-extra1`
DEB       . Supported profile: `output:hdmi-surround71-extra1`
DEB     + Card port added: `hdmi-output-0` (`HDMI / DisplayPort`); priority: 5900; direction: 1; available: No
DEB       . Supported profile: `output:hdmi-stereo`
DEB       . Supported profile: `output:hdmi-surround`
DEB       . Supported profile: `output:hdmi-surround71`
DEB   + Card[1] added: `alsa_card.pci-0000_00_1b.0`
DEB     + Card profile added: `output:analog-stereo` (`Analog Stereo Output`), 1 sinks, 0 sources, priority: 1000
DEB     + Card profile added: `off` (`Off`), 0 sinks, 0 sources, priority: 0
DEB     + Card profile added: `output:analog-stereo+input:analog-stereo` (`Analog Stereo Duplex`), 1 sinks, 1 sources, priority: 1010 -- Active
DEB     + Card profile added: `input:analog-stereo` (`Analog Stereo Input`), 0 sinks, 1 sources, priority: 10
DEB     + Card port added: `analog-input-headphone-mic` (`Microphone`); priority: 8700; direction: 2; available: No
DEB       . Supported profile: `input:analog-stereo`
DEB       . Supported profile: `output:analog-stereo+input:analog-stereo`
DEB     + Card port added: `analog-output-headphones` (`Headphones`); priority: 9000; direction: 1; available: No
DEB       . Supported profile: `output:analog-stereo`
DEB       . Supported profile: `output:analog-stereo+input:analog-stereo`
DEB     + Card port added: `analog-output-speaker` (`Speakers`); priority: 10000; direction: 1; available: Yes
DEB       . Supported profile: `output:analog-stereo`
DEB       . Supported profile: `output:analog-stereo+input:analog-stereo`
DEB     + Card port added: `analog-input-headset-mic` (`Headset Microphone`); priority: 8700; direction: 2; available: No
DEB       . Supported profile: `input:analog-stereo`
DEB       . Supported profile: `output:analog-stereo+input:analog-stereo`
DEB     + Card port added: `analog-input-internal-mic` (`Internal Microphone`); priority: 8900; direction: 2; available: Yes
DEB       . Supported profile: `input:analog-stereo`
DEB       . Supported profile: `output:analog-stereo+input:analog-stereo`
DEB   + Source[2] added: `alsa_input.pci-0000_00_1b.0.analog-stereo`, card 1
DEB     + Source port added: `analog-input-internal-mic` (`Internal Microphone`); priority: 8900; available: Yes
DEB     + Source port added: `analog-input-headphone-mic` (`Microphone`); priority: 8700; available: No
DEB     + Source port added: `analog-input-headset-mic` (`Headset Microphone`); priority: 8700; available: No
DEB     * Activated source port `analog-input-internal-mic`
DEB   + Source output[1] added: `Peak detect`
DEB   + Sink[0] added: `alsa_output.pci-0000_00_03.0.hdmi-surround`, card 0
DEB     + Sink port added: `hdmi-output-0` (`HDMI / DisplayPort`); priority: 5900; available: No
DEB     * Activated sink port `hdmi-output-0`
DEB   + Sink[1] added: `alsa_output.pci-0000_00_1b.0.analog-stereo`, card 1
DEB     + Sink port added: `analog-output-speaker` (`Speakers`); priority: 10000; available: Yes
DEB     + Sink port added: `analog-output-headphones` (`Headphones`); priority: 9000; available: No
DEB     * Activated sink port `analog-output-speaker`
DEB   + Sink[2] added: `Cincopuntouno`, card 4294967295
DEB * Activated sink: `alsa_output.pci-0000_00_1b.0.analog-stereo`
DEB * Activated source: `alsa_input.pci-0000_00_1b.0.analog-stereo`
DEB .do_context_subscribe(facility: 7, kind: 16, index: 4294967295)
DEB * Activated sink: `Cincopuntouno`
DEB * Activated source: `alsa_input.pci-0000_00_1b.0.analog-stereo`
yktoo commented 7 years ago

Okay so that's the sink called Cincopuntouno, and it doesn't have any ports?

ngiraldo commented 7 years ago

Yep, I added the tunnel to the remote sound server as Cincopuntouno.

Do you need the output of another test?

yktoo commented 7 years ago

No, thanks.

A new version that supports network sinks/sources is pushed to dev. Please test if you can.

ngiraldo commented 7 years ago

Now I get this:

Traceback (most recent call last):
  File "_ctypes/callbacks.c", line 234, in 'calling callback function'
  File "./indicator-sound-switcher", line 375, in pacb_sink_info
    self.sink_info(struct.contents)
  File "./indicator-sound-switcher", line 687, in sink_info
    port.get_menu_item_title(),
  File "/usr/lib/python3/dist-packages/indicator_sound_switcher/port.py", line 92, in get_menu_item_title
    (self.owner_card.get_display_name() if self.owner_card else _('(unknown device)')) + \
AttributeError: 'Port' object has no attribute 'owner_card'
yktoo commented 7 years ago

It looks like you're still using the old indicator library. Try running it with:

PYTHONPATH=lib ./indicator-sound-switcher -vv
ngiraldo commented 7 years ago

It works perfectly.

xmbwd commented 7 years ago

I can confirm that the dev version works for network sinks, including Chromecast from mkchromecast.

yktoo commented 5 years ago

Resolved in 2.2.0.