[pulseaudio-discuss] Volume algorithm

Tanu Kaskinen tanuk at iki.fi
Sun Mar 6 12:48:28 PST 2011


On Sat, 2011-03-05 at 11:29 +0000, Tarantism wrote:
> On Sat, 2011-03-05 at 11:08 +0000, Colin Guthrie wrote:
> > 'Twas brillig, and Tarantism at 04/03/11 22:23 did gyre and gimble:
> > > I need to implement a volume scaling in a pulse module.
> > > I have 0-100 input values.
> > > What algorithm does pulse usually implement for this so that I can match
> > > it?
> > 
> > Can you explain a little more what you're trying to do? You shouldn't
> > generally need to worry about volume scaling in PA modules.
> The module is a signal source for the default sink (based on
> module-sine.c) so it creates a sink_input and provides pop (etc)
> callbacks for that. I'm using it to produce low latency sound on Maemo.

Are you planning to use the module outside Maemo 5 (I assume you're
talking about Maemo 5)? I ask because Pulseaudio's internal API that
modules use isn't stable, so modules that aren't part of Pulseaudio
itself break very likely if you try to use them with any other version
of Pulseaudio than what they were compiled against. If Maemo 5 is enough
for you, then you probably won't have problems - I don't think
Pulseaudio will get significant updates on that OS anymore.

> I had expected that system volume would be handled downstream of the
> sink_input but changing system volume has no effect. I've managed to
> hook up to the system volume level by dbus and just want to know how to
> scale my data correctly.

The volume system on Maemo is a bit peculiar. The system volume doesn't
touch any sink volumes (except with bluetooth in HSP/HFP mode), all
volume control is done by adjusting stream volumes. If you want to use
the same volume as eg. the music player, set the media.role property of
the sink input to "x-maemo". That's a special role for pretty much
everything else than phone and event sound streams.

-- 
Tanu




More information about the pulseaudio-discuss mailing list