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.
This commit is contained in:
Arun Raghavan 2010-10-09 15:38:43 +05:30
parent 1d2ef7923d
commit 49101fc540
7 changed files with 24 additions and 19 deletions

View file

@ -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 */