summaryrefslogtreecommitdiffstats
path: root/src/modules/module-waveout.c
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2010-10-09 15:38:43 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2010-10-15 01:10:00 +0530
commit49101fc540aec9a249e97a9f650be38f9f92f5ac (patch)
tree6b2049a66cb3f4c43adcb424468ff2deb852df84 /src/modules/module-waveout.c
parent1d2ef7923d28a74e08a4309b6fa3d36481d2df3b (diff)
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.
Diffstat (limited to 'src/modules/module-waveout.c')
-rw-r--r--src/modules/module-waveout.c4
1 files changed, 2 insertions, 2 deletions
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)