summaryrefslogtreecommitdiff
path: root/src/pulse/volume.h
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/pulse/volume.h
parent1d2ef7923d28a74e08a4309b6fa3d36481d2df3b (diff)
downloadpulseaudio-panda-49101fc540aec9a249e97a9f650be38f9f92f5ac.tar.gz
pulseaudio-panda-49101fc540aec9a249e97a9f650be38f9f92f5ac.tar.bz2
pulseaudio-panda-49101fc540aec9a249e97a9f650be38f9f92f5ac.zip
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/pulse/volume.h')
-rw-r--r--src/pulse/volume.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/pulse/volume.h b/src/pulse/volume.h
index 9ef26f13..2f71a62c 100644
--- a/src/pulse/volume.h
+++ b/src/pulse/volume.h
@@ -121,6 +121,9 @@ typedef uint32_t pa_volume_t;
/** Check if volume is valid. \since 0.9.22 */
#define PA_VOLUME_IS_VALID(v) ((v) <= PA_VOLUME_MAX)
+/** Clamp volume to the permitted range. \since 0.9.22 */
+#define PA_CLAMP_VOLUME(v) (PA_CLAMP_UNLIKELY((v), PA_VOLUME_MUTED, PA_VOLUME_MAX))
+
/** A structure encapsulating a per-channel volume */
typedef struct pa_cvolume {
uint8_t channels; /**< Number of channels */