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/pulse/volume.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/pulse/volume.h') 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 */ -- cgit