diff options
author | wm4 <wm4@nowhere> | 2012-09-18 21:42:09 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-09-23 14:57:37 +0200 |
commit | 85a64b76ccb48c53e5ffca719455f5d623a888a0 (patch) | |
tree | c9e629305b82fc1bd71efc3507306755728f8dae | |
parent | 425ac31a3b07cbef79891d01a3655b9c6d7efa32 (diff) |
ao_pulse: extend maximum settable volume beyond 100%
The old maximum is 100%. Raise it to PA_VOLUME_UI_MAX, which is about
150%. PA_VOLUME_UI_MAX is the PulseAudio recommended UI-settable
maximum volume, so it seems to be a good idea to use that.
-rw-r--r-- | libao2/ao_pulse.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c index d1282cb2dc..b8e4f1cbdd 100644 --- a/libao2/ao_pulse.c +++ b/libao2/ao_pulse.c @@ -34,6 +34,8 @@ #define PULSE_CLIENT_NAME "mplayer2" +#define VOL_PA2MP(v) ((v) * 100 / PA_VOLUME_UI_MAX) +#define VOL_MP2PA(v) ((v) * PA_VOLUME_UI_MAX / 100) struct priv { // PulseAudio playback stream object @@ -473,10 +475,10 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) ao_control_vol_t *vol = arg; if (priv->pi.volume.channels != 2) vol->left = vol->right = - pa_cvolume_avg(&priv->pi.volume) * 100 / PA_VOLUME_NORM; + VOL_PA2MP(pa_cvolume_avg(&priv->pi.volume)); else { - vol->left = priv->pi.volume.values[0] * 100 / PA_VOLUME_NORM; - vol->right = priv->pi.volume.values[1] * 100 / PA_VOLUME_NORM; + vol->left = VOL_PA2MP(priv->pi.volume.values[0]); + vol->right = VOL_PA2MP(priv->pi.volume.values[1]); } } else if (cmd == AOCONTROL_GET_MUTE) { bool *mute = arg; @@ -497,11 +499,10 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg) pa_cvolume_reset(&volume, ao->channels); if (volume.channels != 2) - pa_cvolume_set(&volume, volume.channels, - vol->left * PA_VOLUME_NORM / 100); + pa_cvolume_set(&volume, volume.channels, VOL_MP2PA(vol->left)); else { - volume.values[0] = vol->left * PA_VOLUME_NORM / 100; - volume.values[1] = vol->right * PA_VOLUME_NORM / 100; + volume.values[0] = VOL_MP2PA(vol->left); + volume.values[1] = VOL_MP2PA(vol->right); } o = pa_context_set_sink_input_volume(priv->context, stream_index, &volume, NULL, NULL); |