[pulseaudio-discuss] Changing Volume on Streams ( not Sinks )

Brian Bulkowski brian at bulkowski.org
Sun Jul 28 00:23:20 UTC 2019


I'm trying to figure out if I can change a volume on a stream, not a sink.

The app is a fairly long story, and I'm happy to go into it, but it's a 
lot of streams playing at the same time, and I want ( programmatic ) 
control over each and every stream's volume ( in real time ).

I see everywhere about changing volumes of Sinks, but I've got Streams, 
and multiple streams into a Sink (more precisely, multiple sinks each of 
which with multiple streams which come and go).

Which works very nicely and I'm very happy about using PulseAudio for 
this project.

If one can only change volumes on Sinks, I can do that, define a bunch 
of Sinks in the device configuration ( I don't see a programmatic way ) 
and have exactly one stream per sink, and have those sinks combine, and 
bang away with sink change volume. But then I'll have to create a 
mapping of all the sinks to each sound, make sure when I start a new 
sound I'm using one of the free sinks, etc. Not the end of the world, 
but a lot of complexity if there is a "set volume on stream" and I'm 
just missing it.

I am pretty sure that Streams have volume ( they do when you create them 
), I simply can't find a way to change the volume.

A possibility is "pa_stream_get_index()", what I don't know there is 
whether multiple streams into the same Sink return the same value, or 
some kind of new value, which would allow me to set sink volume by 
index. I supposed I'll be trying that.

Thanks in advance!


PS. I've looked through the archives. There appears there was a 
discussion on a "gmane.org" server in 2014 and that discussion has gone 

PPS. It's sound for an interactive art piece with lots of buttons and 
speakers and raspberry pi's.

More information about the pulseaudio-discuss mailing list