void Sink::setMuted(int muted) { pa_operation *o; o = pa_context_set_sink_mute_by_index(d->context->cObject(), (Device::d)->index, muted, Sink::volume_cb, this); pa_operation_unref(o); }
void pulseaudio_toggle_mute(menu_info_item_t* mii) { g_debug("pulseaudio_toggle_mute(%s)", mii->name); pa_operation* o = NULL; int mute = (mii->mute) ? 0 : 1; switch(mii->menu_info->type) { case MENU_SERVER: case MENU_MODULE: /* nothing to do here */ break; case MENU_SINK: o = pa_context_set_sink_mute_by_index(context, mii->index, mute, pulseaudio_toggle_mute_success_cb, mii); break; case MENU_SOURCE: o = pa_context_set_source_mute_by_index(context, mii->index, mute, pulseaudio_toggle_mute_success_cb, mii); break; case MENU_INPUT: o = pa_context_set_sink_input_mute(context, mii->index, mute, pulseaudio_toggle_mute_success_cb, mii); break; case MENU_OUTPUT: o = pa_context_set_source_output_mute(context, mii->index, mute, pulseaudio_toggle_mute_success_cb, mii); break; } if(o) pa_operation_unref(o); }
static void gst_pulsemixer_ctrl_timeout_event (pa_mainloop_api * a, pa_time_event * e, const struct timeval *tv, void *userdata) { pa_operation *o; GstPulseMixerCtrl *c = GST_PULSEMIXER_CTRL (userdata); if (c->update_volume) { if (c->type == GST_PULSEMIXER_SINK) o = pa_context_set_sink_volume_by_index (c->context, c->index, &c->volume, NULL, NULL); else o = pa_context_set_source_volume_by_index (c->context, c->index, &c->volume, NULL, NULL); if (!o) GST_WARNING_OBJECT (c->object, "Failed to set device volume: %s", pa_strerror (pa_context_errno (c->context))); else pa_operation_unref (o); c->update_volume = FALSE; } if (c->update_mute) { if (c->type == GST_PULSEMIXER_SINK) o = pa_context_set_sink_mute_by_index (c->context, c->index, !!c->muted, NULL, NULL); else o = pa_context_set_source_mute_by_index (c->context, c->index, !!c->muted, NULL, NULL); if (!o) GST_WARNING_OBJECT (c->object, "Failed to set device mute: %s", pa_strerror (pa_context_errno (c->context))); else pa_operation_unref (o); c->update_mute = FALSE; } /* Make sure that all outstanding queries are being ignored */ c->ignore_queries = c->outstandig_queries; g_assert (e == c->time_event); a->time_free (e); c->time_event = NULL; }
void backend_mute_set(context_t *c, backend_entry_type type, uint32_t idx, int v) { switch(type) { case SINK: pa_context_set_sink_mute_by_index(c->context, idx, v, NULL, NULL); break; case SINK_INPUT: pa_context_set_sink_input_mute(c->context, idx, v, NULL, NULL); break; case SOURCE: pa_context_set_source_mute_by_index(c->context, idx, v, NULL, NULL); break; case SOURCE_OUTPUT: pa_context_set_source_output_mute(c->context, idx, v, NULL, NULL); break; default: break; } }
void xvd_toggle_mute (XvdInstance *i) { pa_operation *op = NULL; if (!i || !i->pulse_context) { g_warning ("xvd_toggle_mute: pulseaudio context is null"); return; } if (pa_context_get_state (i->pulse_context) != PA_CONTEXT_READY) { g_warning ("xvd_toggle_mute: pulseaudio context isn't ready"); return; } if (i->sink_index == PA_INVALID_INDEX) { g_warning ("xvd_toggle_mute: undefined sink"); return; } /* backup existing mute and update */ i->mute = !(old_mute = i->mute); op = pa_context_set_sink_mute_by_index (i->pulse_context, i->sink_index, i->mute, xvd_notify_volume_callback, i); if (!op) { g_warning ("xvd_toggle_mute: failed"); return; } pa_operation_unref (op); }