TransWikia.com

Get active sink in PulseAudio

Unix & Linux Asked by InspectorMustache on January 4, 2021

As PulseAudio (amazingly) doesn’t provide any simple query commands, I’m parsing the output from pacmd list-sinks to get the index of the active sink.
However, I’m not sure what lines actually indicate which sink is active. I know that the index line has an asterisk in front of it if it’s the default sink. That doesn’t appear to be the same as the active sink, though. When I connect a bluetooth speaker, that’s what all audio goes through, nevertheless, sink 0 is still marked as default. When audio is playing, the sink that is outputting it displays ‘state: RUNNING’. But once playback stops, that goes back to SUSPENDED.

Is there any reliable way to find out what sink PulseAudio will use for audio?

One Answer

It seems I need to gain a greater understanding of the PulseAudio nomenclature. Listing sources marks the bluetooth speaker correctly as default. And since sources and sinks apparently share the same index, I can pass the index number extracted from pacmd list-sources to pactl set-sink-volume to change volume. Because pactl set-source-volume does nothing. I can't really make sense of it but it does work.

Answered by InspectorMustache on January 4, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP