[pulseaudio-discuss] [pulseaudio-commits] src/pulsecore

Tanu Kaskinen tanuk at iki.fi
Thu Aug 25 14:43:55 PDT 2011


On Thu, 2011-08-25 at 08:50 -0700, Arun Raghavan wrote:
> src/pulsecore/sink.c   |    2 +-
>  src/pulsecore/source.c |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> New commits:
> commit af8d0a12e9bbb2a04ef30bf56f32e360a003ee66
> Author: Arun Raghavan <arun.raghavan at collabora.co.uk>
> Date:   Thu Aug 25 21:17:51 2011 +0530
> 
>     passthrough: Fix what volume we set sinks/sources to
>     
>     Devices' 0 dB is base_volume not PA_VOLUME_NORM.
> 
> diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c
> index b6c260f..b0c360d 100644
> --- a/src/pulsecore/sink.c
> +++ b/src/pulsecore/sink.c
> @@ -1406,7 +1406,7 @@ void pa_sink_enter_passthrough(pa_sink *s) {
>      s->saved_volume = *pa_sink_get_volume(s, TRUE);
>      s->saved_save_volume = s->save_volume;
>  
> -    pa_cvolume_set(&volume, s->sample_spec.channels, PA_VOLUME_NORM);
> +    pa_cvolume_set(&volume, s->sample_spec.channels, s->base_volume);
>      pa_sink_set_volume(s, &volume, TRUE, FALSE);
>  }
>  
> diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c
> index 4605656..d79dbb1 100644
> --- a/src/pulsecore/source.c
> +++ b/src/pulsecore/source.c
> @@ -986,7 +986,7 @@ void pa_source_enter_passthrough(pa_source *s) {
>      s->saved_volume = *pa_source_get_volume(s, TRUE);
>      s->saved_save_volume = s->save_volume;
>  
> -    pa_cvolume_set(&volume, s->sample_spec.channels, PA_VOLUME_NORM);
> +    pa_cvolume_set(&volume, s->sample_spec.channels, s->base_volume);
>      pa_source_set_volume(s, &volume, TRUE, FALSE);
>  }

I think the volume should be set to PA_MIN(s->base_volume,
PA_VOLUME_NORM). The base volume can be higher than NORM in some cases,
which will cause software amplification if the code is left as it is
now.

-- 
Tanu



More information about the pulseaudio-discuss mailing list