GeorgeFilipkin / pulsemixer

CLI and curses mixer for PulseAudio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setting ID via command line does not appear to work - defaults to main sink regardless of "--id="

jakefanvote opened this issue · comments

I am trying out your mixer on the command line and cannot get the ID selection to work.

pulsemixer  --list                  
Sink input:	 ID: 470, Name: Firefox, Mute: 0, Channels: 2, Volumes: ['90%', '90%']
Sink:		 ID: 0, Name: Built-in Audio Digital Stereo (HDMI), Mute: 0, Channels: 2, Volumes: ['65%', '65%']
Sink:		 ID: 1, Name: Built-in Audio Analog Stereo, Mute: 1, Channels: 2, Volumes: ['64%', '64%']
Source:		 ID: 0, Name: Monitor of Built-in Audio Digital Stereo (HDMI), Mute: 0, Channels: 2, Volumes: ['100%', '100%']
Source:		 ID: 1, Name: Monitor of Built-in Audio Analog Stereo, Mute: 0, Channels: 2, Volumes: ['100%', '100%']
Source:		 ID: 2, Name: Built-in Audio Analog Stereo, Mute: 1, Channels: 2, Volumes: ['100%', '100%']

The default sink is ID = 1 and 64% volume - other IDs have other values for volumes not 64%.
if I run the following (using switch format --id=[ID] or --id [ID] )

> pulsemixer --get-volume --id=470
64 64
> pulsemixer --get-volume --id=2
64 64

I am actually looking to use the mute function from the command line but it and other commands likewise only report or effect the default sink regardless of ID specified.
I am running on a up to date Arch linux os, pulseaudio 10.0 and python = 3.6.2
The curses interface works fine - I can mute only firefox for example.
I looked through the code but being a python newbie I couldn't find the issue.
Thanks for you very useful work.

--id must be specified before the command, i.e. pulsemixer --id=470 --get-volume. If --id isn't specified of specified after --get-volume or any other command, then that command will use default sink.

I realize it is incredibly ambiguous (and not covered in README), but it was done to avoid consecutive calls to pulsemixer, to chain commands with a single call. For example you could do this:

pulsemixer --id 470 --get-volume --id 2 --get-volume --change-volume +5 --get-volume
90 90
100 100
105 105

Initially I was writing pulsemixer just for myself and really wanted this weird behavior. Now not so much.

It also has a nasty limitation. As you can see in your --list output, pulseaudio doesn't use globally unique id's and can assign the same id to sink and source. In this case pulsemixer cli gives priority to sink. So at this moment there is no way to access Source 0 via --id 0, because Sink 0 will get priority.

tl;dr I'm not sure if I should keep this behavior or change it to something more obvious and less tricky. Your thoughts?

Wow, thanks for the quick reply - I should have tried moving the id switch after reading the note you had about precedence in the command line switches - maybe just a note in the README would suffice.
As far as correcting the the id's and the reusing of them to get to sink/sources - if it makes sense for you to tackle (I have no idea how much work that would take seeing it's mainly a pulse audio issue) otherwise again noting that behavior in the README might suffice for most use cases. Thanks again - I like the curses interface - very nicely laid out and functional.