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/oss/oss-util.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/modules/oss/oss-util.c') diff --git a/src/modules/oss/oss-util.c b/src/modules/oss/oss-util.c index b95023c3..966a6ca1 100644 --- a/src/modules/oss/oss-util.c +++ b/src/modules/oss/oss-util.c @@ -271,10 +271,10 @@ int pa_oss_get_volume(int fd, unsigned long mixer, const pa_sample_spec *ss, pa_ pa_cvolume_reset(volume, ss->channels); - volume->values[0] = ((vol & 0xFF) * PA_VOLUME_NORM) / 100; + volume->values[0] = PA_CLAMP_VOLUME(((vol & 0xFF) * PA_VOLUME_NORM) / 100); if (volume->channels >= 2) - volume->values[1] = (((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100; + volume->values[1] = PA_CLAMP_VOLUME((((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100); pa_log_debug("Read mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume)); return 0; -- cgit