[pulseaudio-discuss] pactl percentage bug fix
Tanu Kaskinen
tanuk at iki.fi
Mon Jun 6 11:37:29 UTC 2022
On Sat, 2022-06-04 at 23:05 -0700, Sean Greenslade wrote:
> On Sun, Jun 05, 2022 at 01:51:55AM +0100, Patrick May wrote:
> > On 04/06/2022 08:48, Sean Greenslade wrote:
> >
> > > While debugging, I did notice another issue that I was uncertain of how
> > > to solve. The detection of absolute values vs. relative values is based
> > > on the presence of a plus or minus at the start of the value. This is
> > > fine for everything except decibels, since absolute decibel values will
> > > often be negative numbers. The way the code sits now, it's impossible to
> > > pass an absolute negative decibel value. Probably not a huge deal, but
> > > it seemed worth pointing out.
> >
> > I tested it with
> >
> > pactl -- set-sink-volume 0 0db
> >
> > and it sets the volume to 100%. So the ability to specify absolute decibel
> > values is only useful if you like blasting stuff at greater than or equal to
> > 100% volume
>
> As I said, it's a bug. When I said it's probably not a huge deal, I
> meant in the sense that I doubt many people have ever tried to use the
> decibel versions of this command, seeing as this bug makes the absolute
> decibel inputs nearly useless.
>
> My reason for bringing it up was to try and solicit opinions on how best
> to fix it. The current method of assuming a "-" always means relative is
> not good, but I can't think of a clean way to fix it. Less clean options
> that jump to mind:
> - Add a new command, e.g. "set-sink-decibels-absolute -3dB"
> - Add a new suffix variant, e.g. "set-sink-volume -3dBAbs"
> (note that "dBA" is not acceptable, since that has a specific meaning
> with regards to sound measurement)
> - Have a prefix for absolute numbers, e.g. "set-sink-volume =-3dB"
>
> What do other people think?
There probably aren't any nice-looking solutions to this... My
suggestion would be to use
pactl set-sink-volume --absolute/--relative sinkname -3dB
-- Tanu
More information about the pulseaudio-discuss
mailing list