From 49101fc540aec9a249e97a9f650be38f9f92f5ac Mon Sep 17 00:00:00 2001 From: Arun Raghavan Date: Sat, 9 Oct 2010 15:38:43 +0530 Subject: volume: Clamp volume to PA_VOLUME_MAX This ensures that we always clamp the volume to PA_VOLUME_MAX. While this currently has no effect, it will be required for making sure we don't exceed PA_VOLUME_MAX when its value changes in the future. --- src/modules/module-waveout.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/module-waveout.c') diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c index d1b9f2ff..6fedceb2 100644 --- a/src/modules/module-waveout.c +++ b/src/modules/module-waveout.c @@ -359,8 +359,8 @@ static int sink_get_hw_volume_cb(pa_sink *s) { if (waveOutGetVolume(u->hwo, &vol) != MMSYSERR_NOERROR) return -1; - left = (vol & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME; - right = ((vol >> 16) & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME; + left = PA_CLAMP_VOLUME((vol & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME); + right = PA_CLAMP_VOLUME(((vol >> 16) & 0xFFFF) * PA_VOLUME_NORM / WAVEOUT_MAX_VOLUME); /* Windows supports > 2 channels, except for volume control */ if (s->hw_volume.channels > 2) -- cgit