diff options
Diffstat (limited to '')
-rw-r--r-- | src/mixer_all.c | 12 | ||||
-rw-r--r-- | src/mixer_all.h | 2 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/mixer_all.c b/src/mixer_all.c index 21ff44c35..980f854a2 100644 --- a/src/mixer_all.c +++ b/src/mixer_all.c @@ -70,12 +70,13 @@ mixer_all_get_volume(void) } static bool -output_mixer_set_volume(unsigned i, int volume) +output_mixer_set_volume(unsigned i, unsigned volume) { struct audio_output *output; struct mixer *mixer; assert(i < audio_output_count()); + assert(volume <= 100); output = audio_output_get(i); if (!output->enabled) @@ -85,20 +86,17 @@ output_mixer_set_volume(unsigned i, int volume) if (mixer == NULL) return false; - if (volume > 100) - volume = 100; - else if (volume < 0) - volume = 0; - return mixer_set_volume(mixer, volume); } bool -mixer_all_set_volume(int volume) +mixer_all_set_volume(unsigned volume) { bool success = false; unsigned count = audio_output_count(); + assert(volume <= 100); + for (unsigned i = 0; i < count; i++) success = output_mixer_set_volume(i, volume) || success; diff --git a/src/mixer_all.h b/src/mixer_all.h index 1f6e016df..e7c9eecc8 100644 --- a/src/mixer_all.h +++ b/src/mixer_all.h @@ -41,6 +41,6 @@ mixer_all_get_volume(void); * @return true on success, false on failure */ bool -mixer_all_set_volume(int volume); +mixer_all_set_volume(unsigned volume); #endif |