aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-03-27 16:44:37 +0100
committerMax Kellermann <max@duempel.org>2009-03-27 16:44:37 +0100
commit7f762a5cec9b4547182b13e577f5f8e48be46a8e (patch)
tree29fb89dc72d9109b282e891dab6eed46cd53d98c /src
parent13319e0b70f603c35b601464fde875f207a44b93 (diff)
downloadmpd-7f762a5cec9b4547182b13e577f5f8e48be46a8e.tar.gz
mpd-7f762a5cec9b4547182b13e577f5f8e48be46a8e.tar.xz
mpd-7f762a5cec9b4547182b13e577f5f8e48be46a8e.zip
pulse_mixer: return if mixer is offline
Eliminate one indent level. Also remove several debug useless debug messages.
Diffstat (limited to 'src')
-rw-r--r--src/mixer/pulse_mixer.c56
1 files changed, 27 insertions, 29 deletions
diff --git a/src/mixer/pulse_mixer.c b/src/mixer/pulse_mixer.c
index f6b9acd40..1f077e2b7 100644
--- a/src/mixer/pulse_mixer.c
+++ b/src/mixer/pulse_mixer.c
@@ -314,49 +314,47 @@ pulse_mixer_get_volume(struct mixer *mixer)
int ret;
pa_operation *o;
- g_debug("get_volume %s",
- pm->online == TRUE ? "online" : "offline");
- if (pm->online) {
- o = pa_context_get_sink_input_info(pm->context, pm->index,
- sink_input_vol, pm);
- if (o == NULL) {
- g_debug("pa_context_get_sink_input_info() failed");
- return false;
- }
-
- if (!pulse_wait_for_operation(pm->mainloop, o))
- return false;
+ if (!pm->online) {
+ return false;
+ }
- ret = (int)((100*(pa_cvolume_avg(&pm->volume)+1))/PA_VOLUME_NORM);
- g_debug("volume %d", ret);
- return ret;
+ o = pa_context_get_sink_input_info(pm->context, pm->index,
+ sink_input_vol, pm);
+ if (o == NULL) {
+ g_debug("pa_context_get_sink_input_info() failed");
+ return false;
}
- return false;
+ if (!pulse_wait_for_operation(pm->mainloop, o))
+ return false;
+
+ ret = (int)((100*(pa_cvolume_avg(&pm->volume)+1))/PA_VOLUME_NORM);
+ return ret;
}
static bool
pulse_mixer_set_volume(struct mixer *mixer, unsigned volume)
{
struct pulse_mixer *pm = (struct pulse_mixer *) mixer;
+ struct pa_cvolume cvolume;
+ pa_operation *o;
- if (pm->online) {
- pa_operation *o;
- struct pa_cvolume cvolume;
-
- pa_cvolume_set(&cvolume, pm->volume.channels,
- (pa_volume_t)volume * PA_VOLUME_NORM / 100 + 0.5);
+ if (!pm->online) {
+ return false;
+ }
- o = pa_context_set_sink_input_volume(pm->context, pm->index,
- &cvolume, NULL, NULL);
- if (o == NULL) {
- g_debug("pa_context_set_sink_input_volume() failed");
- return false;
- }
+ pa_cvolume_set(&cvolume, pm->volume.channels,
+ (pa_volume_t)volume * PA_VOLUME_NORM / 100 + 0.5);
- pa_operation_unref(o);
+ o = pa_context_set_sink_input_volume(pm->context, pm->index,
+ &cvolume, NULL, NULL);
+ if (o == NULL) {
+ g_debug("pa_context_set_sink_input_volume() failed");
+ return false;
}
+ pa_operation_unref(o);
+
return true;
}