python-pulse-control: Combined sink returns as running / detecting activity

When creating a combined sink, the sink state will return “running” even though no audio is playing back through it. This is my ~/.config/pulse/default.pa:

.include /etc/pulse/default.pa

load-module module-combine-sink sink_name=micspam_output sink_properties=device.description=Micspam
load-module module-remap-source source_name=micspam_input source_properties=device.description=Micspam master=micspam_output.monitor

The media.role of the combined sink is “filter” and its state is “DRAINED”. Both appear to be undocumented, as I can’t find information on either.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 23 (15 by maintainers)

Commits related to this issue

Most upvoted comments

print(pulse.get_peak_sample(sink.index, 5))

There’s your problem, I think. Use sink.monitor_source instead of sink.index. Note that argument there is “source_idx”, not “sink_idx” - these are different and opposite concepts in pulse, as you probably know. Every sink gets name=sink.monitor source associated with it though, which is the one you probably want to use, and sink.monitor_source should give you index for it. Docstring for that func should also have a (somewhat convoluted) example of using monitor_source and sink input at the same time (wanted to cram everything into one example there).

I’ll check what happens if you specify non-existing source index - ideally that should raise an error, and I kinda assumed that pulse calls would do that (return values for them are checked), but maybe error-handling itself hangs somewhere…