falconindy / ponymix

CLI volume control for PulseAudio
MIT License
177 stars 27 forks source link

mute, unmut, toggle together with --source do not target the default device #30

Closed SuperFluffy closed 9 years ago

SuperFluffy commented 9 years ago

The following are all my devices:

% ponymix list
sink 0: alsa_output.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 100%
source 0: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
  Monitor of Built-in Audio Analog Stereo
  Avg. Volume: 100% [Muted]
source 1: alsa_input.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 38% [Muted]

sink 0 and source 1 are set as the defaults, respectively:

% ponymix defaults
sink 0: alsa_output.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 100%
source 1: alsa_input.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 38% [Muted]

It turns out that if I execute ponymix --source toggle, not the default source is affected, as I would expect, but instead the source 0 device (maybe because it has a lower index?):

% ponymix --source toggle
100
% ponymix list    
sink 0: alsa_output.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 100%
source 0: alsa_output.pci-0000_00_1b.0.analog-stereo.monitor
  Monitor of Built-in Audio Analog Stereo
  Avg. Volume: 100%
source 1: alsa_input.pci-0000_00_1b.0.analog-stereo
  Built-in Audio Analog Stereo
  Avg. Volume: 38% [Muted]

Is this working as intended? Or is there a way to actually have --source target the default device?

falconindy commented 9 years ago

Looks brokeass to me -- main() always defaults opt_device to the sink device without regard for the opt_devtype.

falconindy commented 9 years ago

Does 78ef2f963dc9b0b0c5466ed9d84ea6f29d85db88 resolve this?

SuperFluffy commented 9 years ago

Awesome, this fixes it! I will also open a new issue, wich might be related.