mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -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
|
|
@ -191,7 +191,7 @@ pa_operation *pa_context_play_sample(pa_context *c, const char *name, const char
|
|||
pa_tagstruct_putu32(t, PA_INVALID_INDEX);
|
||||
pa_tagstruct_puts(t, dev);
|
||||
|
||||
if (volume == PA_VOLUME_INVALID && c->version < 15)
|
||||
if (!PA_VOLUME_IS_VALID(volume) && c->version < 15)
|
||||
volume = PA_VOLUME_NORM;
|
||||
|
||||
pa_tagstruct_putu32(t, volume);
|
||||
|
|
@ -232,7 +232,7 @@ pa_operation *pa_context_play_sample_with_proplist(pa_context *c, const char *na
|
|||
pa_tagstruct_putu32(t, PA_INVALID_INDEX);
|
||||
pa_tagstruct_puts(t, dev);
|
||||
|
||||
if (volume == PA_VOLUME_INVALID && c->version < 15)
|
||||
if (!PA_VOLUME_IS_VALID(volume) && c->version < 15)
|
||||
volume = PA_VOLUME_NORM;
|
||||
|
||||
pa_tagstruct_putu32(t, volume);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue