17
17
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
21
#include "mixer_all.h"
21
22
#include "mixer_control.h"
22
23
#include "output_all.h"
23
24
#include "output_plugin.h"
24
25
#include "output_internal.h"
26
#include "pcm_volume.h"
27
#include "mixer_api.h"
28
#include "mixer_list.h"
49
return mixer_get_volume(mixer);
55
volume = mixer_get_volume(mixer, &error);
56
if (volume < 0 && error != NULL) {
57
g_warning("Failed to read mixer for '%s': %s",
58
output->name, error->message);
73
output_mixer_set_volume(unsigned i, int volume, bool relative)
86
output_mixer_set_volume(unsigned i, unsigned volume)
75
88
struct audio_output *output;
76
89
struct mixer *mixer;
78
93
assert(i < audio_output_count());
94
assert(volume <= 100);
80
96
output = audio_output_get(i);
81
97
if (!output->enabled)
85
101
if (mixer == NULL)
89
int prev = mixer_get_volume(mixer);
104
success = mixer_set_volume(mixer, volume, &error);
105
if (!success && error != NULL) {
106
g_warning("Failed to set mixer for '%s': %s",
107
output->name, error->message);
101
return mixer_set_volume(mixer, volume);
105
mixer_all_set_volume(int volume, bool relative)
115
mixer_all_set_volume(unsigned volume)
107
117
bool success = false;
108
118
unsigned count = audio_output_count();
120
assert(volume <= 100);
110
122
for (unsigned i = 0; i < count; i++)
111
success = output_mixer_set_volume(i, volume, relative)
123
success = output_mixer_set_volume(i, volume)
130
output_mixer_get_software_volume(unsigned i)
132
struct audio_output *output;
135
assert(i < audio_output_count());
137
output = audio_output_get(i);
138
if (!output->enabled)
141
mixer = output->mixer;
142
if (mixer == NULL || mixer->plugin != &software_mixer_plugin)
145
return mixer_get_volume(mixer, NULL);
149
mixer_all_get_software_volume(void)
151
unsigned count = audio_output_count(), ok = 0;
152
int volume, total = 0;
154
for (unsigned i = 0; i < count; i++) {
155
volume = output_mixer_get_software_volume(i);
169
mixer_all_set_software_volume(unsigned volume)
171
unsigned count = audio_output_count();
173
assert(volume <= PCM_VOLUME_1);
175
for (unsigned i = 0; i < count; i++) {
176
struct audio_output *output = audio_output_get(i);
177
if (output->mixer != NULL &&
178
output->mixer->plugin == &software_mixer_plugin)
179
mixer_set_volume(output->mixer, volume, NULL);