[vlc-devel] [PATCH] Use soft gain by default to achieve 200% with directsound

Denis Charmet typx at dinauz.org
Tue Aug 13 10:07:37 CEST 2013


Le jeudi 08 août 2013 à 10:44:54, Rémi Denis-Courmont a écrit :
> > Since directsound doesn't support amplification, we use a default *2 soft
> > gain and map DSBVOLUME_MAX to 200%.
> 
> Note that I care as a Linux user, but that will confuse the volume control in 
> the Windows mixer.
>

Well in any case we have to either confuse the mixer or introduce an
audio delay, considering the hidden part of the this mixer, I think it's
a lesser evil.
 
> > This change is restricted to float32 to limit possible saturation
> 
> That subtlety will be very hard for users to grasp. Some don't even understand 
> that S/PDIF cannot be attenuated.
> 
Fair enough, I could extend that to the S16N.

> > +    /* millibels from linear amplification map 200% on DSBVOLUME_MAX */
> > +    LONG mb = lroundf( 5000.f * log10f( volume / 2.f ));
> 
> This seems wrong for the S16N case.
> 
Can be extended...

> > 
> >      /* Clamp to allowed DirectSound range */
> >      static_assert( DSBVOLUME_MIN < DSBVOLUME_MAX, "DSBVOLUME_* confused" );
> > if( mb > DSBVOLUME_MAX )
> > -    {
> >          mb = DSBVOLUME_MAX;
> > -        ret = -1;
> > -    }
> 
> That's a separate and debatable change of its own.
> 
I'll remove that.

Regards,

-- 
Denis Charmet - TypX
Le mauvais esprit est un art de vivre



More information about the vlc-devel mailing list