mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
volume: Use a macro to check if a volume is valid
This adds a PA_VOLUME_IS_VALID() macro for checking if a given pa_volume_t is valid. This makes changes to the volume ranges simpler (just change PA_VOLUME_MAX, for example, without needing to modify any other code).
This commit is contained in:
parent
4d84a00b49
commit
1d2ef7923d
9 changed files with 30 additions and 27 deletions
|
|
@ -118,6 +118,9 @@ typedef uint32_t pa_volume_t;
|
|||
/** Special 'invalid' volume. \since 0.9.16 */
|
||||
#define PA_VOLUME_INVALID ((pa_volume_t) UINT32_MAX)
|
||||
|
||||
/** Check if volume is valid. \since 0.9.22 */
|
||||
#define PA_VOLUME_IS_VALID(v) ((v) <= PA_VOLUME_MAX)
|
||||
|
||||
/** A structure encapsulating a per-channel volume */
|
||||
typedef struct pa_cvolume {
|
||||
uint8_t channels; /**< Number of channels */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue