pulse_mixer: return if mixer is offline

Eliminate one indent level.  Also remove several debug useless debug
messages.
This commit is contained in:
Max Kellermann 2009-03-27 16:44:37 +01:00
parent 13319e0b70
commit 7f762a5cec

View File

@ -314,9 +314,10 @@ pulse_mixer_get_volume(struct mixer *mixer)
int ret; int ret;
pa_operation *o; pa_operation *o;
g_debug("get_volume %s", if (!pm->online) {
pm->online == TRUE ? "online" : "offline"); return false;
if (pm->online) { }
o = pa_context_get_sink_input_info(pm->context, pm->index, o = pa_context_get_sink_input_info(pm->context, pm->index,
sink_input_vol, pm); sink_input_vol, pm);
if (o == NULL) { if (o == NULL) {
@ -328,21 +329,19 @@ pulse_mixer_get_volume(struct mixer *mixer)
return false; return false;
ret = (int)((100*(pa_cvolume_avg(&pm->volume)+1))/PA_VOLUME_NORM); ret = (int)((100*(pa_cvolume_avg(&pm->volume)+1))/PA_VOLUME_NORM);
g_debug("volume %d", ret);
return ret; return ret;
}
return false;
} }
static bool static bool
pulse_mixer_set_volume(struct mixer *mixer, unsigned volume) pulse_mixer_set_volume(struct mixer *mixer, unsigned volume)
{ {
struct pulse_mixer *pm = (struct pulse_mixer *) mixer; struct pulse_mixer *pm = (struct pulse_mixer *) mixer;
if (pm->online) {
pa_operation *o;
struct pa_cvolume cvolume; struct pa_cvolume cvolume;
pa_operation *o;
if (!pm->online) {
return false;
}
pa_cvolume_set(&cvolume, pm->volume.channels, pa_cvolume_set(&cvolume, pm->volume.channels,
(pa_volume_t)volume * PA_VOLUME_NORM / 100 + 0.5); (pa_volume_t)volume * PA_VOLUME_NORM / 100 + 0.5);
@ -355,7 +354,6 @@ pulse_mixer_set_volume(struct mixer *mixer, unsigned volume)
} }
pa_operation_unref(o); pa_operation_unref(o);
}
return true; return true;
} }