diff options
author | Viliam Mateicka <viliam.mateicka@gmail.com> | 2008-12-31 16:46:41 +0100 |
---|---|---|
committer | Viliam Mateicka <viliam.mateicka@gmail.com> | 2008-12-31 16:46:41 +0100 |
commit | 9a70c4d06d51cca24dfb93847d1f82187d454e31 (patch) | |
tree | 444672f0ab76eca96692560201287d6f7a1a73b5 /src/audio.c | |
parent | dd9af72a744d9c93966f5088931d7edbf28e1d1d (diff) |
Moving mixers to audio outputs
Diffstat (limited to 'src/audio.c')
-rw-r--r-- | src/audio.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/audio.c b/src/audio.c index 0567b6452..17e63416a 100644 --- a/src/audio.c +++ b/src/audio.c @@ -25,6 +25,7 @@ #include "client.h" #include "idle.h" #include "utils.h" +#include "mixer.h" #include <glib.h> @@ -428,3 +429,57 @@ errline: } } +bool mixer_control_setvol(unsigned int device, int volume, int rel) +{ + struct audio_output *output; + if (device >= audioOutputArraySize) + return false; + + output = &audioOutputArray[device]; + if (output->plugin && output->plugin->control) { + if (rel) { + int cur_volume; + if (!output->plugin->control(output->data, AC_MIXER_GETVOL, &cur_volume)) { + return false; + } + volume = volume + cur_volume; + } + if (volume > 100) + volume = 100; + else if (volume < 0) + volume = 0; + + return output->plugin->control(output->data, AC_MIXER_SETVOL, &volume); + } + return false; +} + +bool mixer_control_getvol(unsigned int device, int *volume) +{ + struct audio_output *output; + if (device >= audioOutputArraySize) + return false; + + output = &audioOutputArray[device]; + if (output->plugin && output->plugin->control) { + return output->plugin->control(output->data, AC_MIXER_GETVOL, volume); + } + return false; +} + +bool mixer_configure_legacy(char *name, ConfigParam *param) +{ + unsigned i; + struct audio_output *output; + + for (i = 0; i < audioOutputArraySize; ++i) { + output = &audioOutputArray[i]; + if (output && output->plugin && !strcmp(name, output->plugin->name)) { + if (output->plugin->control) { + g_debug("reconfiguring %s mixer\n", name); + return output->plugin->control(output->data, AC_MIXER_CONFIGURE, param); + } + } + } + return false; +} |