/* Volume-control.c generated by valac 0.56.19, the Vala compiler
 * generated from Volume-control.vala, do not modify */

/*
 * -*- Mode:Vala; indent-tabs-mode:t; tab-width:4; encoding:utf8 -*-
 * Copyright 2013 Canonical Ltd.
 *           2015-2017 elementary, Inc. (http://launchpad.net/wingpanel)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Authors:
 *      Alberto Ruiz <alberto.ruiz@canonical.com>
 *      Ted Gould <ted@canonical.com>
 */

#include "sound.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <glib-object.h>
#include <pulse/volume.h>
#include <pulse/pulseaudio.h>
#include <gee.h>
#include <gio/gio.h>
#include <pulse/glib-mainloop.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	SOUND_SERVICES_VOLUME_CONTROL_0_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_STREAM_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_READY_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_ACTIVE_MIC_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_HIGH_VOLUME_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_MUTE_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_MIC_MUTE_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_IS_PLAYING_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_IS_LISTENING_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_VOLUME_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_MIC_VOLUME_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_HEADPHONE_PLUGGED_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_NUM_PROPERTIES
};
static GParamSpec* sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
enum  {
	SOUND_SERVICES_VOLUME_CONTROL_VOLUME_0_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_VOLUME_NUM_PROPERTIES
};
static GParamSpec* sound_services_volume_control_volume_properties[SOUND_SERVICES_VOLUME_CONTROL_VOLUME_NUM_PROPERTIES];
enum  {
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_0_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_STREAM_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_READY_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_ACTIVE_MIC_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_HIGH_VOLUME_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_MUTE_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_MUTE_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_PLAYING_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_LISTENING_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_VOLUME_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_VOLUME_PROPERTY,
	SOUND_SERVICES_VOLUME_CONTROL_PULSE_NUM_PROPERTIES
};
static GParamSpec* sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_NUM_PROPERTIES];
#define _pa_context_unref0(var) ((var == NULL) ? NULL : (var = (pa_context_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _pa_glib_mainloop_free0(var) ((var == NULL) ? NULL : (var = (pa_glib_mainloop_free (var), NULL)))
#define _pa_operation_unref0(var) ((var == NULL) ? NULL : (var = (pa_operation_unref (var), NULL)))
#define _pa_proplist_free0(var) ((var == NULL) ? NULL : (var = (pa_proplist_free (var), NULL)))
typedef struct _SoundServicesVolumeControlPulseReconnectToPulseData SoundServicesVolumeControlPulseReconnectToPulseData;
typedef struct _SoundServicesVolumeControlPulseUpdateActiveSinkInputData SoundServicesVolumeControlPulseUpdateActiveSinkInputData;

struct _SoundServicesVolumeControlPrivate {
	SoundServicesVolumeControlVolume* _volume;
	gboolean _headphone_plugged;
};

struct _SoundServicesVolumeControlPulsePrivate {
	guint _reconnect_timer;
	pa_context* context;
	gboolean _mute;
	gboolean _mute_mic;
	gboolean _is_playing;
	gboolean _is_listening;
	SoundServicesVolumeControlVolume* _volume;
	gdouble _mic_volume;
	GeeArrayList* _sink_input_list;
	GeeHashMap* _sink_input_hash;
	gboolean _pulse_use_stream_restore;
	gint32 _active_sink_input;
	gchar** _valid_roles;
	gint _valid_roles_length1;
	gint __valid_roles_size_;
	gchar* _objp_role_multimedia;
	gchar* _objp_role_alert;
	gchar* _objp_role_alarm;
	gchar* _objp_role_phone;
	GCancellable* _mute_cancellable;
	GCancellable* _volume_cancellable;
	guint _local_volume_timer;
	gboolean _send_next_local_volume;
	gboolean _ready;
	gboolean _active_mic;
};

struct _SoundServicesVolumeControlPulseReconnectToPulseData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SoundServicesVolumeControlPulse* self;
	gboolean _tmp0_;
	gboolean _tmp1_;
	pa_context* _tmp2_;
	pa_proplist* props;
	pa_proplist* _tmp3_;
	pa_proplist* _tmp4_;
	pa_proplist* _tmp5_;
	pa_proplist* _tmp6_;
	pa_proplist* _tmp7_;
	pa_glib_mainloop* _tmp8_;
	pa_mainloop_api* _tmp9_;
	pa_proplist* _tmp10_;
	pa_context* _tmp11_;
	pa_context* _tmp12_;
	pa_context* _tmp13_;
	pa_context* _tmp14_;
	const gchar* _tmp15_;
};

struct _SoundServicesVolumeControlPulseUpdateActiveSinkInputData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	SoundServicesVolumeControlPulse* self;
	gint32 index;
};

static gint SoundServicesVolumeControl_private_offset;
static gpointer sound_services_volume_control_parent_class = NULL;
static gpointer sound_services_volume_control_volume_parent_class = NULL;
static gint SoundServicesVolumeControlPulse_private_offset;
static gpointer sound_services_volume_control_pulse_parent_class = NULL;
static pa_glib_mainloop* sound_services_volume_control_pulse_loop;
static pa_glib_mainloop* sound_services_volume_control_pulse_loop = NULL;

static void sound_services_volume_control_real_set_mute (SoundServicesVolumeControl* self,
                                                  gboolean mute);
static void sound_services_volume_control_volume_finalize (GObject * obj);
static GType sound_services_volume_control_volume_get_type_once (void);
static void sound_services_volume_control_finalize (GObject * obj);
static GType sound_services_volume_control_get_type_once (void);
static void _vala_sound_services_volume_control_get_property (GObject * object,
                                                       guint property_id,
                                                       GValue * value,
                                                       GParamSpec * pspec);
static void _vala_sound_services_volume_control_set_property (GObject * object,
                                                       guint property_id,
                                                       const GValue * value,
                                                       GParamSpec * pspec);
static void sound_services_volume_control_pulse_stop_local_volume_timer (SoundServicesVolumeControlPulse* self);
static void sound_services_volume_control_pulse_reconnect_to_pulse (SoundServicesVolumeControlPulse* self,
                                                             GAsyncReadyCallback _callback_,
                                                             gpointer _user_data_);
static void sound_services_volume_control_pulse_reconnect_to_pulse_finish (SoundServicesVolumeControlPulse* self,
                                                                    GAsyncResult* _res_);
static void sound_services_volume_control_pulse_context_events_cb (SoundServicesVolumeControlPulse* self,
                                                            pa_context* c,
                                                            pa_subscription_event_type_t t,
                                                            guint32 index);
static void sound_services_volume_control_pulse_update_sink (SoundServicesVolumeControlPulse* self);
static void sound_services_volume_control_pulse_handle_new_sink_input_cb (SoundServicesVolumeControlPulse* self,
                                                                   pa_context* c,
                                                                   pa_sink_input_info* i,
                                                                   gint eol);
static void _sound_services_volume_control_pulse_handle_new_sink_input_cb_pa_sink_input_info_cb_t (pa_context* c,
                                                                                            pa_sink_input_info* i,
                                                                                            gint eol,
                                                                                            gpointer self);
static void sound_services_volume_control_pulse_handle_changed_sink_input_cb (SoundServicesVolumeControlPulse* self,
                                                                       pa_context* c,
                                                                       pa_sink_input_info* i,
                                                                       gint eol);
static void _sound_services_volume_control_pulse_handle_changed_sink_input_cb_pa_sink_input_info_cb_t (pa_context* c,
                                                                                                pa_sink_input_info* i,
                                                                                                gint eol,
                                                                                                gpointer self);
static void sound_services_volume_control_pulse_remove_sink_input_from_list (SoundServicesVolumeControlPulse* self,
                                                                      guint32 index);
static void sound_services_volume_control_pulse_update_source (SoundServicesVolumeControlPulse* self);
static void sound_services_volume_control_pulse_source_output_info_cb (SoundServicesVolumeControlPulse* self,
                                                                pa_context* c,
                                                                pa_source_output_info* i,
                                                                gint eol);
static void _sound_services_volume_control_pulse_source_output_info_cb_pa_source_output_info_cb_t (pa_context* c,
                                                                                            pa_source_output_info* i,
                                                                                            gint eol,
                                                                                            gpointer self);
static void sound_services_volume_control_pulse_sink_info_cb_for_props (SoundServicesVolumeControlPulse* self,
                                                                 pa_context* c,
                                                                 pa_sink_info* i,
                                                                 gint eol);
static gdouble sound_services_volume_control_pulse_volume_to_double (pa_volume_t vol);
static void sound_services_volume_control_pulse_source_info_cb (SoundServicesVolumeControlPulse* self,
                                                         pa_context* c,
                                                         pa_source_info* i,
                                                         gint eol);
static void sound_services_volume_control_pulse_server_info_cb_for_props (SoundServicesVolumeControlPulse* self,
                                                                   pa_context* c,
                                                                   pa_server_info* i);
static void _sound_services_volume_control_pulse_sink_info_cb_for_props_pa_sink_info_cb_t (pa_context* c,
                                                                                    pa_sink_info* i,
                                                                                    gint eol,
                                                                                    gpointer self);
static void _sound_services_volume_control_pulse_server_info_cb_for_props_pa_server_info_cb_t (pa_context* c,
                                                                                        pa_server_info* i,
                                                                                        gpointer self);
static void sound_services_volume_control_pulse_update_source_get_server_info_cb (SoundServicesVolumeControlPulse* self,
                                                                           pa_context* c,
                                                                           pa_server_info* i);
static void _sound_services_volume_control_pulse_source_info_cb_pa_source_info_cb_t (pa_context* c,
                                                                              pa_source_info* i,
                                                                              gint eol,
                                                                              gpointer self);
static void _sound_services_volume_control_pulse_update_source_get_server_info_cb_pa_server_info_cb_t (pa_context* c,
                                                                                                pa_server_info* i,
                                                                                                gpointer self);
static void sound_services_volume_control_pulse_add_sink_input_into_list (SoundServicesVolumeControlPulse* self,
                                                                   pa_sink_input_info* sink_input);
static gboolean _vala_string_array_contains (gchar* * stack,
                                      gssize stack_length,
                                      const gchar* needle);
static void sound_services_volume_control_pulse_update_active_sink_input (SoundServicesVolumeControlPulse* self,
                                                                   gint32 index,
                                                                   GAsyncReadyCallback _callback_,
                                                                   gpointer _user_data_);
static void sound_services_volume_control_pulse_update_active_sink_input_finish (SoundServicesVolumeControlPulse* self,
                                                                          GAsyncResult* _res_);
static void sound_services_volume_control_pulse_context_state_callback (SoundServicesVolumeControlPulse* self,
                                                                 pa_context* c);
static void _sound_services_volume_control_pulse_context_events_cb_pa_context_subscribe_cb_t (pa_context* c,
                                                                                       pa_subscription_event_type_t t,
                                                                                       guint32 idx,
                                                                                       gpointer self);
static gboolean sound_services_volume_control_pulse_reconnect_timeout (SoundServicesVolumeControlPulse* self);
static gboolean _sound_services_volume_control_pulse_reconnect_timeout_gsource_func (gpointer self);
static void sound_services_volume_control_pulse_reconnect_to_pulse_data_free (gpointer _data);
static gboolean sound_services_volume_control_pulse_reconnect_to_pulse_co (SoundServicesVolumeControlPulseReconnectToPulseData* _data_);
static void _sound_services_volume_control_pulse_context_state_callback_pa_context_notify_cb_t (pa_context* c,
                                                                                         gpointer self);
static void sound_services_volume_control_pulse_sink_info_list_callback_set_mute (SoundServicesVolumeControlPulse* self,
                                                                           pa_context* context,
                                                                           pa_sink_info* sink,
                                                                           gint eol);
static void sound_services_volume_control_pulse_sink_info_list_callback_unset_mute (SoundServicesVolumeControlPulse* self,
                                                                             pa_context* context,
                                                                             pa_sink_info* sink,
                                                                             gint eol);
static gboolean sound_services_volume_control_pulse_set_mute_internal (SoundServicesVolumeControlPulse* self,
                                                                gboolean mute);
static void _sound_services_volume_control_pulse_sink_info_list_callback_set_mute_pa_sink_info_cb_t (pa_context* c,
                                                                                              pa_sink_info* i,
                                                                                              gint eol,
                                                                                              gpointer self);
static void _sound_services_volume_control_pulse_sink_info_list_callback_unset_mute_pa_sink_info_cb_t (pa_context* c,
                                                                                                pa_sink_info* i,
                                                                                                gint eol,
                                                                                                gpointer self);
static void sound_services_volume_control_pulse_real_set_mute (SoundServicesVolumeControl* base,
                                                        gboolean mute);
static void sound_services_volume_control_pulse_source_info_list_callback_set_mute (SoundServicesVolumeControlPulse* self,
                                                                             pa_context* context,
                                                                             pa_source_info* source,
                                                                             gint eol);
static void sound_services_volume_control_pulse_source_info_list_callback_unset_mute (SoundServicesVolumeControlPulse* self,
                                                                               pa_context* context,
                                                                               pa_source_info* source,
                                                                               gint eol);
static gboolean sound_services_volume_control_pulse_set_mic_mute_internal (SoundServicesVolumeControlPulse* self,
                                                                    gboolean m);
static void _sound_services_volume_control_pulse_source_info_list_callback_set_mute_pa_source_info_cb_t (pa_context* c,
                                                                                                  pa_source_info* i,
                                                                                                  gint eol,
                                                                                                  gpointer self);
static void _sound_services_volume_control_pulse_source_info_list_callback_unset_mute_pa_source_info_cb_t (pa_context* c,
                                                                                                    pa_source_info* i,
                                                                                                    gint eol,
                                                                                                    gpointer self);
static pa_volume_t sound_services_volume_control_pulse_double_to_volume (gdouble vol);
static void sound_services_volume_control_pulse_set_volume_success_cb (SoundServicesVolumeControlPulse* self,
                                                                pa_context* c,
                                                                gint success);
static void sound_services_volume_control_pulse_sink_info_set_volume_cb (SoundServicesVolumeControlPulse* self,
                                                                  pa_context* c,
                                                                  pa_sink_info* i,
                                                                  gint eol);
static void _sound_services_volume_control_pulse_set_volume_success_cb_pa_context_success_cb_t (pa_context* c,
                                                                                         gint success,
                                                                                         gpointer self);
static void sound_services_volume_control_pulse_server_info_cb_for_set_volume (SoundServicesVolumeControlPulse* self,
                                                                        pa_context* c,
                                                                        pa_server_info* i);
static void _sound_services_volume_control_pulse_sink_info_set_volume_cb_pa_sink_info_cb_t (pa_context* c,
                                                                                     pa_sink_info* i,
                                                                                     gint eol,
                                                                                     gpointer self);
static void sound_services_volume_control_pulse_set_mic_volume_success_cb (SoundServicesVolumeControlPulse* self,
                                                                    pa_context* c,
                                                                    gint success);
static void sound_services_volume_control_pulse_set_mic_volume_get_server_info_cb (SoundServicesVolumeControlPulse* self,
                                                                            pa_context* c,
                                                                            pa_server_info* i);
static void _sound_services_volume_control_pulse_set_mic_volume_success_cb_pa_context_success_cb_t (pa_context* c,
                                                                                             gint success,
                                                                                             gpointer self);
static void sound_services_volume_control_pulse_update_active_sink_input_data_free (gpointer _data);
static gboolean sound_services_volume_control_pulse_update_active_sink_input_co (SoundServicesVolumeControlPulseUpdateActiveSinkInputData* _data_);
static void sound_services_volume_control_pulse_start_local_volume_timer (SoundServicesVolumeControlPulse* self);
static gboolean sound_services_volume_control_pulse_local_volume_changed_timeout (SoundServicesVolumeControlPulse* self);
static gboolean _sound_services_volume_control_pulse_local_volume_changed_timeout_gsource_func (gpointer self);
static void _sound_services_volume_control_pulse_server_info_cb_for_set_volume_pa_server_info_cb_t (pa_context* c,
                                                                                             pa_server_info* i,
                                                                                             gpointer self);
static void _sound_services_volume_control_pulse_set_mic_volume_get_server_info_cb_pa_server_info_cb_t (pa_context* c,
                                                                                                 pa_server_info* i,
                                                                                                 gpointer self);
static void sound_services_volume_control_pulse_finalize (GObject * obj);
static GType sound_services_volume_control_pulse_get_type_once (void);
static void _vala_sound_services_volume_control_pulse_get_property (GObject * object,
                                                             guint property_id,
                                                             GValue * value,
                                                             GParamSpec * pspec);
static void _vala_sound_services_volume_control_pulse_set_property (GObject * object,
                                                             guint property_id,
                                                             const GValue * value,
                                                             GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
sound_services_volume_control_get_instance_private (SoundServicesVolumeControl* self)
{
	return G_STRUCT_MEMBER_P (self, SoundServicesVolumeControl_private_offset);
}

static GType
sound_services_volume_control_volume_reasons_get_type_once (void)
{
	static const GEnumValue values[] = {{SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_PULSE_CHANGE, "SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_PULSE_CHANGE", "pulse-change"}, {SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_ACCOUNTS_SERVICE_SET, "SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_ACCOUNTS_SERVICE_SET", "accounts-service-set"}, {SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_DEVICE_OUTPUT_CHANGE, "SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_DEVICE_OUTPUT_CHANGE", "device-output-change"}, {SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_USER_KEYPRESS, "SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_USER_KEYPRESS", "user-keypress"}, {SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_VOLUME_STREAM_CHANGE, "SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_VOLUME_STREAM_CHANGE", "volume-stream-change"}, {0, NULL, NULL}};
	GType sound_services_volume_control_volume_reasons_type_id;
	sound_services_volume_control_volume_reasons_type_id = g_enum_register_static ("SoundServicesVolumeControlVolumeReasons", values);
	return sound_services_volume_control_volume_reasons_type_id;
}

GType
sound_services_volume_control_volume_reasons_get_type (void)
{
	static volatile gsize sound_services_volume_control_volume_reasons_type_id__once = 0;
	if (g_once_init_enter (&sound_services_volume_control_volume_reasons_type_id__once)) {
		GType sound_services_volume_control_volume_reasons_type_id;
		sound_services_volume_control_volume_reasons_type_id = sound_services_volume_control_volume_reasons_get_type_once ();
		g_once_init_leave (&sound_services_volume_control_volume_reasons_type_id__once, sound_services_volume_control_volume_reasons_type_id);
	}
	return sound_services_volume_control_volume_reasons_type_id__once;
}

static void
sound_services_volume_control_real_set_mute (SoundServicesVolumeControl* self,
                                             gboolean mute)
{
	g_critical ("Type `%s' does not implement abstract method `sound_services_volume_control_set_mute'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}

void
sound_services_volume_control_set_mute (SoundServicesVolumeControl* self,
                                        gboolean mute)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->set_mute) {
		_klass_->set_mute (self, mute);
	}
}

SoundServicesVolumeControl*
sound_services_volume_control_construct (GType object_type)
{
	SoundServicesVolumeControl * self = NULL;
	self = (SoundServicesVolumeControl*) g_object_new (object_type, NULL);
	return self;
}

const gchar*
sound_services_volume_control_get_stream (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_stream) {
		return _klass_->get_stream (self);
	}
	return NULL;
}

static const gchar*
sound_services_volume_control_real_get_stream (SoundServicesVolumeControl* base)
{
	const gchar* result;
	SoundServicesVolumeControl* self;
	self = base;
	result = "";
	return result;
}

gboolean
sound_services_volume_control_get_ready (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_ready) {
		return _klass_->get_ready (self);
	}
	return FALSE;
}

static gboolean
sound_services_volume_control_real_get_ready (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControl* self;
	self = base;
	result = FALSE;
	return result;
}

void
sound_services_volume_control_set_ready (SoundServicesVolumeControl* self,
                                         gboolean value)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->set_ready) {
		_klass_->set_ready (self, value);
	}
}

static void
sound_services_volume_control_real_set_ready (SoundServicesVolumeControl* base,
                                              gboolean value)
{
	SoundServicesVolumeControl* self;
	self = base;
	g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_READY_PROPERTY]);
}

gboolean
sound_services_volume_control_get_active_mic (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_active_mic) {
		return _klass_->get_active_mic (self);
	}
	return FALSE;
}

static gboolean
sound_services_volume_control_real_get_active_mic (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControl* self;
	self = base;
	result = FALSE;
	return result;
}

void
sound_services_volume_control_set_active_mic (SoundServicesVolumeControl* self,
                                              gboolean value)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->set_active_mic) {
		_klass_->set_active_mic (self, value);
	}
}

static void
sound_services_volume_control_real_set_active_mic (SoundServicesVolumeControl* base,
                                                   gboolean value)
{
	SoundServicesVolumeControl* self;
	self = base;
	g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_ACTIVE_MIC_PROPERTY]);
}

gboolean
sound_services_volume_control_get_high_volume (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_high_volume) {
		return _klass_->get_high_volume (self);
	}
	return FALSE;
}

static gboolean
sound_services_volume_control_real_get_high_volume (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControl* self;
	self = base;
	result = FALSE;
	return result;
}

gboolean
sound_services_volume_control_get_mute (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_mute) {
		return _klass_->get_mute (self);
	}
	return FALSE;
}

static gboolean
sound_services_volume_control_real_get_mute (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControl* self;
	self = base;
	result = FALSE;
	return result;
}

gboolean
sound_services_volume_control_get_mic_mute (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_mic_mute) {
		return _klass_->get_mic_mute (self);
	}
	return FALSE;
}

static gboolean
sound_services_volume_control_real_get_mic_mute (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControl* self;
	self = base;
	result = FALSE;
	return result;
}

gboolean
sound_services_volume_control_get_is_playing (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_is_playing) {
		return _klass_->get_is_playing (self);
	}
	return FALSE;
}

static gboolean
sound_services_volume_control_real_get_is_playing (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControl* self;
	self = base;
	result = FALSE;
	return result;
}

gboolean
sound_services_volume_control_get_is_listening (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_is_listening) {
		return _klass_->get_is_listening (self);
	}
	return FALSE;
}

static gboolean
sound_services_volume_control_real_get_is_listening (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControl* self;
	self = base;
	result = FALSE;
	return result;
}

SoundServicesVolumeControlVolume*
sound_services_volume_control_get_volume (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_volume) {
		return _klass_->get_volume (self);
	}
	return NULL;
}

static SoundServicesVolumeControlVolume*
sound_services_volume_control_real_get_volume (SoundServicesVolumeControl* base)
{
	SoundServicesVolumeControlVolume* result;
	SoundServicesVolumeControl* self;
	SoundServicesVolumeControlVolume* _tmp0_;
	self = base;
	_tmp0_ = self->priv->_volume;
	result = _tmp0_;
	return result;
}

void
sound_services_volume_control_set_volume (SoundServicesVolumeControl* self,
                                          SoundServicesVolumeControlVolume* value)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->set_volume) {
		_klass_->set_volume (self, value);
	}
}

static void
sound_services_volume_control_real_set_volume (SoundServicesVolumeControl* base,
                                               SoundServicesVolumeControlVolume* value)
{
	SoundServicesVolumeControl* self;
	self = base;
	g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_VOLUME_PROPERTY]);
}

gdouble
sound_services_volume_control_get_mic_volume (SoundServicesVolumeControl* self)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_val_if_fail (self != NULL, -1.0);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->get_mic_volume) {
		return _klass_->get_mic_volume (self);
	}
	return -1.0;
}

static gdouble
sound_services_volume_control_real_get_mic_volume (SoundServicesVolumeControl* base)
{
	gdouble result;
	SoundServicesVolumeControl* self;
	self = base;
	result = 0.0;
	return result;
}

void
sound_services_volume_control_set_mic_volume (SoundServicesVolumeControl* self,
                                              gdouble value)
{
	SoundServicesVolumeControlClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = SOUND_SERVICES_VOLUME_CONTROL_GET_CLASS (self);
	if (_klass_->set_mic_volume) {
		_klass_->set_mic_volume (self, value);
	}
}

static void
sound_services_volume_control_real_set_mic_volume (SoundServicesVolumeControl* base,
                                                   gdouble value)
{
	SoundServicesVolumeControl* self;
	self = base;
	g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_MIC_VOLUME_PROPERTY]);
}

gboolean
sound_services_volume_control_get_headphone_plugged (SoundServicesVolumeControl* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_headphone_plugged;
	return result;
}

void
sound_services_volume_control_set_headphone_plugged (SoundServicesVolumeControl* self,
                                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = sound_services_volume_control_get_headphone_plugged (self);
	if (old_value != value) {
		self->priv->_headphone_plugged = value;
		g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_HEADPHONE_PLUGGED_PROPERTY]);
	}
}

SoundServicesVolumeControlVolume*
sound_services_volume_control_volume_construct (GType object_type)
{
	SoundServicesVolumeControlVolume * self = NULL;
	self = (SoundServicesVolumeControlVolume*) g_object_new (object_type, NULL);
	return self;
}

SoundServicesVolumeControlVolume*
sound_services_volume_control_volume_new (void)
{
	return sound_services_volume_control_volume_construct (SOUND_SERVICES_VOLUME_CONTROL_TYPE_VOLUME);
}

static void
sound_services_volume_control_volume_class_init (SoundServicesVolumeControlVolumeClass * klass,
                                                 gpointer klass_data)
{
	sound_services_volume_control_volume_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->finalize = sound_services_volume_control_volume_finalize;
}

static void
sound_services_volume_control_volume_instance_init (SoundServicesVolumeControlVolume * self,
                                                    gpointer klass)
{
}

static void
sound_services_volume_control_volume_finalize (GObject * obj)
{
	SoundServicesVolumeControlVolume * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SOUND_SERVICES_VOLUME_CONTROL_TYPE_VOLUME, SoundServicesVolumeControlVolume);
	G_OBJECT_CLASS (sound_services_volume_control_volume_parent_class)->finalize (obj);
}

static GType
sound_services_volume_control_volume_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SoundServicesVolumeControlVolumeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sound_services_volume_control_volume_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SoundServicesVolumeControlVolume), 0, (GInstanceInitFunc) sound_services_volume_control_volume_instance_init, NULL };
	GType sound_services_volume_control_volume_type_id;
	sound_services_volume_control_volume_type_id = g_type_register_static (G_TYPE_OBJECT, "SoundServicesVolumeControlVolume", &g_define_type_info, 0);
	return sound_services_volume_control_volume_type_id;
}

GType
sound_services_volume_control_volume_get_type (void)
{
	static volatile gsize sound_services_volume_control_volume_type_id__once = 0;
	if (g_once_init_enter (&sound_services_volume_control_volume_type_id__once)) {
		GType sound_services_volume_control_volume_type_id;
		sound_services_volume_control_volume_type_id = sound_services_volume_control_volume_get_type_once ();
		g_once_init_leave (&sound_services_volume_control_volume_type_id__once, sound_services_volume_control_volume_type_id);
	}
	return sound_services_volume_control_volume_type_id__once;
}

static void
sound_services_volume_control_class_init (SoundServicesVolumeControlClass * klass,
                                          gpointer klass_data)
{
	sound_services_volume_control_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SoundServicesVolumeControl_private_offset);
	((SoundServicesVolumeControlClass *) klass)->set_mute = (void (*) (SoundServicesVolumeControl*, gboolean)) sound_services_volume_control_real_set_mute;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_stream = (const gchar* (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_stream;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_ready = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_ready;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_ready = (void (*) (SoundServicesVolumeControl*, gboolean)) sound_services_volume_control_real_set_ready;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_active_mic = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_active_mic;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_active_mic = (void (*) (SoundServicesVolumeControl*, gboolean)) sound_services_volume_control_real_set_active_mic;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_high_volume = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_high_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_mute = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_mute;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_mic_mute = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_mic_mute;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_is_playing = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_is_playing;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_is_listening = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_is_listening;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_volume = (SoundServicesVolumeControlVolume* (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_volume = (void (*) (SoundServicesVolumeControl*, SoundServicesVolumeControlVolume*)) sound_services_volume_control_real_set_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_mic_volume = (gdouble (*) (SoundServicesVolumeControl*)) sound_services_volume_control_real_get_mic_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_mic_volume = (void (*) (SoundServicesVolumeControl*, gdouble)) sound_services_volume_control_real_set_mic_volume;
	G_OBJECT_CLASS (klass)->get_property = _vala_sound_services_volume_control_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_sound_services_volume_control_set_property;
	G_OBJECT_CLASS (klass)->finalize = sound_services_volume_control_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_STREAM_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_STREAM_PROPERTY] = g_param_spec_string ("stream", "stream", "stream", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_READY_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_READY_PROPERTY] = g_param_spec_boolean ("ready", "ready", "ready", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_ACTIVE_MIC_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_ACTIVE_MIC_PROPERTY] = g_param_spec_boolean ("active-mic", "active-mic", "active-mic", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_HIGH_VOLUME_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_HIGH_VOLUME_PROPERTY] = g_param_spec_boolean ("high-volume", "high-volume", "high-volume", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_MUTE_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_MUTE_PROPERTY] = g_param_spec_boolean ("mute", "mute", "mute", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_MIC_MUTE_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_MIC_MUTE_PROPERTY] = g_param_spec_boolean ("mic-mute", "mic-mute", "mic-mute", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_IS_PLAYING_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_IS_PLAYING_PROPERTY] = g_param_spec_boolean ("is-playing", "is-playing", "is-playing", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_IS_LISTENING_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_IS_LISTENING_PROPERTY] = g_param_spec_boolean ("is-listening", "is-listening", "is-listening", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_VOLUME_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_VOLUME_PROPERTY] = g_param_spec_object ("volume", "volume", "volume", SOUND_SERVICES_VOLUME_CONTROL_TYPE_VOLUME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_MIC_VOLUME_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_MIC_VOLUME_PROPERTY] = g_param_spec_double ("mic-volume", "mic-volume", "mic-volume", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_HEADPHONE_PLUGGED_PROPERTY, sound_services_volume_control_properties[SOUND_SERVICES_VOLUME_CONTROL_HEADPHONE_PLUGGED_PROPERTY] = g_param_spec_boolean ("headphone-plugged", "headphone-plugged", "headphone-plugged", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
sound_services_volume_control_instance_init (SoundServicesVolumeControl * self,
                                             gpointer klass)
{
	self->priv = sound_services_volume_control_get_instance_private (self);
	self->priv->_headphone_plugged = FALSE;
}

static void
sound_services_volume_control_finalize (GObject * obj)
{
	SoundServicesVolumeControl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SOUND_SERVICES_TYPE_VOLUME_CONTROL, SoundServicesVolumeControl);
	_g_object_unref0 (self->priv->_volume);
	G_OBJECT_CLASS (sound_services_volume_control_parent_class)->finalize (obj);
}

static GType
sound_services_volume_control_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SoundServicesVolumeControlClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sound_services_volume_control_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SoundServicesVolumeControl), 0, (GInstanceInitFunc) sound_services_volume_control_instance_init, NULL };
	GType sound_services_volume_control_type_id;
	sound_services_volume_control_type_id = g_type_register_static (G_TYPE_OBJECT, "SoundServicesVolumeControl", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	SoundServicesVolumeControl_private_offset = g_type_add_instance_private (sound_services_volume_control_type_id, sizeof (SoundServicesVolumeControlPrivate));
	return sound_services_volume_control_type_id;
}

GType
sound_services_volume_control_get_type (void)
{
	static volatile gsize sound_services_volume_control_type_id__once = 0;
	if (g_once_init_enter (&sound_services_volume_control_type_id__once)) {
		GType sound_services_volume_control_type_id;
		sound_services_volume_control_type_id = sound_services_volume_control_get_type_once ();
		g_once_init_leave (&sound_services_volume_control_type_id__once, sound_services_volume_control_type_id);
	}
	return sound_services_volume_control_type_id__once;
}

static void
_vala_sound_services_volume_control_get_property (GObject * object,
                                                  guint property_id,
                                                  GValue * value,
                                                  GParamSpec * pspec)
{
	SoundServicesVolumeControl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SOUND_SERVICES_TYPE_VOLUME_CONTROL, SoundServicesVolumeControl);
	switch (property_id) {
		case SOUND_SERVICES_VOLUME_CONTROL_STREAM_PROPERTY:
		g_value_set_string (value, sound_services_volume_control_get_stream (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_READY_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_ready (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_ACTIVE_MIC_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_active_mic (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_HIGH_VOLUME_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_high_volume (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_MUTE_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_mute (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_MIC_MUTE_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_mic_mute (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_IS_PLAYING_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_is_playing (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_IS_LISTENING_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_is_listening (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_VOLUME_PROPERTY:
		g_value_set_object (value, sound_services_volume_control_get_volume (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_MIC_VOLUME_PROPERTY:
		g_value_set_double (value, sound_services_volume_control_get_mic_volume (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_HEADPHONE_PLUGGED_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_headphone_plugged (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_sound_services_volume_control_set_property (GObject * object,
                                                  guint property_id,
                                                  const GValue * value,
                                                  GParamSpec * pspec)
{
	SoundServicesVolumeControl * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SOUND_SERVICES_TYPE_VOLUME_CONTROL, SoundServicesVolumeControl);
	switch (property_id) {
		case SOUND_SERVICES_VOLUME_CONTROL_READY_PROPERTY:
		sound_services_volume_control_set_ready (self, g_value_get_boolean (value));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_ACTIVE_MIC_PROPERTY:
		sound_services_volume_control_set_active_mic (self, g_value_get_boolean (value));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_VOLUME_PROPERTY:
		sound_services_volume_control_set_volume (self, g_value_get_object (value));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_MIC_VOLUME_PROPERTY:
		sound_services_volume_control_set_mic_volume (self, g_value_get_double (value));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_HEADPHONE_PLUGGED_PROPERTY:
		sound_services_volume_control_set_headphone_plugged (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
sound_services_volume_control_pulse_get_instance_private (SoundServicesVolumeControlPulse* self)
{
	return G_STRUCT_MEMBER_P (self, SoundServicesVolumeControlPulse_private_offset);
}

SoundServicesVolumeControlPulse*
sound_services_volume_control_pulse_construct (GType object_type)
{
	SoundServicesVolumeControlPulse * self = NULL;
	SoundServicesVolumeControlVolume* _tmp0_;
	SoundServicesVolumeControlVolume* _tmp1_;
	pa_glib_mainloop* _tmp2_;
	GCancellable* _tmp4_;
	GCancellable* _tmp5_;
	self = (SoundServicesVolumeControlPulse*) sound_services_volume_control_construct (object_type);
	_tmp0_ = self->priv->_volume;
	_tmp0_->volume = 0.0;
	_tmp1_ = self->priv->_volume;
	_tmp1_->reason = SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_PULSE_CHANGE;
	_tmp2_ = sound_services_volume_control_pulse_loop;
	if (_tmp2_ == NULL) {
		pa_glib_mainloop* _tmp3_;
		_tmp3_ = pa_glib_mainloop_new (NULL);
		_pa_glib_mainloop_free0 (sound_services_volume_control_pulse_loop);
		sound_services_volume_control_pulse_loop = _tmp3_;
	}
	_tmp4_ = g_cancellable_new ();
	_g_object_unref0 (self->priv->_mute_cancellable);
	self->priv->_mute_cancellable = _tmp4_;
	_tmp5_ = g_cancellable_new ();
	_g_object_unref0 (self->priv->_volume_cancellable);
	self->priv->_volume_cancellable = _tmp5_;
	sound_services_volume_control_pulse_reconnect_to_pulse (self, NULL, NULL);
	return self;
}

SoundServicesVolumeControlPulse*
sound_services_volume_control_pulse_new (void)
{
	return sound_services_volume_control_pulse_construct (SOUND_SERVICES_TYPE_VOLUME_CONTROL_PULSE);
}

static void
_sound_services_volume_control_pulse_handle_new_sink_input_cb_pa_sink_input_info_cb_t (pa_context* c,
                                                                                       pa_sink_input_info* i,
                                                                                       gint eol,
                                                                                       gpointer self)
{
	sound_services_volume_control_pulse_handle_new_sink_input_cb ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
_sound_services_volume_control_pulse_handle_changed_sink_input_cb_pa_sink_input_info_cb_t (pa_context* c,
                                                                                           pa_sink_input_info* i,
                                                                                           gint eol,
                                                                                           gpointer self)
{
	sound_services_volume_control_pulse_handle_changed_sink_input_cb ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
_sound_services_volume_control_pulse_source_output_info_cb_pa_source_output_info_cb_t (pa_context* c,
                                                                                       pa_source_output_info* i,
                                                                                       gint eol,
                                                                                       gpointer self)
{
	sound_services_volume_control_pulse_source_output_info_cb ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
sound_services_volume_control_pulse_context_events_cb (SoundServicesVolumeControlPulse* self,
                                                       pa_context* c,
                                                       pa_subscription_event_type_t t,
                                                       guint32 index)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {
		case PA_SUBSCRIPTION_EVENT_SINK:
		{
			sound_services_volume_control_pulse_update_sink (self);
			break;
		}
		case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
		{
			switch (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) {
				case PA_SUBSCRIPTION_EVENT_NEW:
				{
					pa_operation* _tmp0_;
					pa_operation* _tmp1_;
					_tmp0_ = pa_context_get_sink_input_info (c, index, _sound_services_volume_control_pulse_handle_new_sink_input_cb_pa_sink_input_info_cb_t, self);
					_tmp1_ = _tmp0_;
					_pa_operation_unref0 (_tmp1_);
					break;
				}
				case PA_SUBSCRIPTION_EVENT_CHANGE:
				{
					pa_operation* _tmp2_;
					pa_operation* _tmp3_;
					_tmp2_ = pa_context_get_sink_input_info (c, index, _sound_services_volume_control_pulse_handle_changed_sink_input_cb_pa_sink_input_info_cb_t, self);
					_tmp3_ = _tmp2_;
					_pa_operation_unref0 (_tmp3_);
					break;
				}
				case PA_SUBSCRIPTION_EVENT_REMOVE:
				{
					sound_services_volume_control_pulse_remove_sink_input_from_list (self, index);
					break;
				}
				default:
				{
					g_debug ("Volume-control.vala:160: Sink input event not known.");
					break;
				}
			}
			break;
		}
		case PA_SUBSCRIPTION_EVENT_SOURCE:
		{
			sound_services_volume_control_pulse_update_source (self);
			break;
		}
		case PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT:
		{
			switch (t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) {
				case PA_SUBSCRIPTION_EVENT_NEW:
				{
					pa_operation* _tmp4_;
					pa_operation* _tmp5_;
					_tmp4_ = pa_context_get_source_output_info (c, index, _sound_services_volume_control_pulse_source_output_info_cb_pa_source_output_info_cb_t, self);
					_tmp5_ = _tmp4_;
					_pa_operation_unref0 (_tmp5_);
					break;
				}
				case PA_SUBSCRIPTION_EVENT_REMOVE:
				{
					sound_services_volume_control_set_active_mic ((SoundServicesVolumeControl*) self, FALSE);
					break;
				}
				default:
				break;
			}
			break;
		}
		default:
		break;
	}
}

static void
sound_services_volume_control_pulse_sink_info_cb_for_props (SoundServicesVolumeControlPulse* self,
                                                            pa_context* c,
                                                            pa_sink_info* i,
                                                            gint eol)
{
	gboolean playing = FALSE;
	gboolean _tmp0_ = FALSE;
	pa_sink_port_info* _tmp1_;
	gboolean _tmp14_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		return;
	}
	if (self->priv->_mute != ((gboolean) (*i).mute)) {
		self->priv->_mute = (gboolean) (*i).mute;
		g_object_notify ((GObject*) self, "mute");
	}
	playing = (*i).state == PA_SINK_RUNNING;
	if (self->priv->_is_playing != playing) {
		self->priv->_is_playing = playing;
		g_object_notify ((GObject*) self, "is-playing");
	}
	_tmp1_ = (*i).active_port;
	if (_tmp1_ != NULL) {
		gboolean _tmp2_ = FALSE;
		gboolean _tmp3_ = FALSE;
		pa_sink_port_info* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = (*i).active_port;
		_tmp5_ = (*_tmp4_).name;
		if (g_strcmp0 (_tmp5_, "output-wired_headset") == 0) {
			_tmp3_ = TRUE;
		} else {
			pa_sink_port_info* _tmp6_;
			const gchar* _tmp7_;
			_tmp6_ = (*i).active_port;
			_tmp7_ = (*_tmp6_).name;
			_tmp3_ = g_strcmp0 (_tmp7_, "output-wired_headphone") == 0;
		}
		if (_tmp3_) {
			_tmp2_ = TRUE;
		} else {
			pa_sink_port_info* _tmp8_;
			const gchar* _tmp9_;
			_tmp8_ = (*i).active_port;
			_tmp9_ = (*_tmp8_).name;
			_tmp2_ = g_strcmp0 (_tmp9_, "analog-output-headphones") == 0;
		}
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gboolean _tmp10_;
		gboolean _tmp11_;
		_tmp10_ = sound_services_volume_control_get_headphone_plugged ((SoundServicesVolumeControl*) self);
		_tmp11_ = _tmp10_;
		if (!_tmp11_) {
			sound_services_volume_control_set_headphone_plugged ((SoundServicesVolumeControl*) self, TRUE);
			g_debug ("Volume-control.vala:209: headphone plugged in\n");
		}
	} else {
		gboolean _tmp12_;
		gboolean _tmp13_;
		_tmp12_ = sound_services_volume_control_get_headphone_plugged ((SoundServicesVolumeControl*) self);
		_tmp13_ = _tmp12_;
		if (_tmp13_) {
			sound_services_volume_control_set_headphone_plugged ((SoundServicesVolumeControl*) self, FALSE);
			g_debug ("Volume-control.vala:214: no headphone plugged in\n");
		}
	}
	if (self->priv->_pulse_use_stream_restore == FALSE) {
		SoundServicesVolumeControlVolume* _tmp15_;
		_tmp15_ = self->priv->_volume;
		_tmp14_ = _tmp15_->volume != sound_services_volume_control_pulse_volume_to_double (pa_cvolume_max (&(*i).volume));
	} else {
		_tmp14_ = FALSE;
	}
	if (_tmp14_) {
		SoundServicesVolumeControlVolume* vol = NULL;
		SoundServicesVolumeControlVolume* _tmp16_;
		SoundServicesVolumeControlVolume* _tmp17_;
		SoundServicesVolumeControlVolume* _tmp18_;
		SoundServicesVolumeControlVolume* _tmp19_;
		_tmp16_ = sound_services_volume_control_volume_new ();
		vol = _tmp16_;
		_tmp17_ = vol;
		_tmp17_->volume = sound_services_volume_control_pulse_volume_to_double (pa_cvolume_max (&(*i).volume));
		_tmp18_ = vol;
		_tmp18_->reason = SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_PULSE_CHANGE;
		_tmp19_ = vol;
		sound_services_volume_control_set_volume ((SoundServicesVolumeControl*) self, _tmp19_);
		_g_object_unref0 (vol);
	}
}

static void
sound_services_volume_control_pulse_source_info_cb (SoundServicesVolumeControlPulse* self,
                                                    pa_context* c,
                                                    pa_source_info* i,
                                                    gint eol)
{
	gboolean _tmp0_ = FALSE;
	gboolean listening = FALSE;
	pa_cvolume _tmp1_;
	pa_volume_t _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		return;
	}
	if (self->priv->_mute_mic != ((gboolean) (*i).mute)) {
		self->priv->_mute_mic = (gboolean) (*i).mute;
		g_object_notify ((GObject*) self, "micMute");
	}
	if ((*i).state == PA_SOURCE_RUNNING) {
		_tmp0_ = (*i).monitor_of_sink == PA_INVALID_INDEX;
	} else {
		_tmp0_ = FALSE;
	}
	listening = _tmp0_;
	if (self->priv->_is_listening != listening) {
		self->priv->_is_listening = listening;
		g_object_notify ((GObject*) self, "is-listening");
	}
	_tmp1_ = (*i).volume;
	_tmp2_ = _tmp1_.values[0];
	if (self->priv->_mic_volume != sound_services_volume_control_pulse_volume_to_double (_tmp2_)) {
		pa_cvolume _tmp3_;
		pa_volume_t _tmp4_;
		_tmp3_ = (*i).volume;
		_tmp4_ = _tmp3_.values[0];
		self->priv->_mic_volume = sound_services_volume_control_pulse_volume_to_double (_tmp4_);
		g_object_notify ((GObject*) self, "mic-volume");
	}
}

static void
_sound_services_volume_control_pulse_sink_info_cb_for_props_pa_sink_info_cb_t (pa_context* c,
                                                                               pa_sink_info* i,
                                                                               gint eol,
                                                                               gpointer self)
{
	sound_services_volume_control_pulse_sink_info_cb_for_props ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
sound_services_volume_control_pulse_server_info_cb_for_props (SoundServicesVolumeControlPulse* self,
                                                              pa_context* c,
                                                              pa_server_info* i)
{
	pa_context* _tmp0_;
	const gchar* _tmp1_;
	pa_operation* _tmp2_;
	pa_operation* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		return;
	}
	_tmp0_ = self->priv->context;
	_tmp1_ = (*i).default_sink_name;
	_tmp2_ = pa_context_get_sink_info_by_name (_tmp0_, _tmp1_, _sound_services_volume_control_pulse_sink_info_cb_for_props_pa_sink_info_cb_t, self);
	_tmp3_ = _tmp2_;
	_pa_operation_unref0 (_tmp3_);
}

static void
_sound_services_volume_control_pulse_server_info_cb_for_props_pa_server_info_cb_t (pa_context* c,
                                                                                   pa_server_info* i,
                                                                                   gpointer self)
{
	sound_services_volume_control_pulse_server_info_cb_for_props ((SoundServicesVolumeControlPulse*) self, c, i);
}

static void
sound_services_volume_control_pulse_update_sink (SoundServicesVolumeControlPulse* self)
{
	pa_context* _tmp0_;
	pa_operation* _tmp1_;
	pa_operation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->context;
	_tmp1_ = pa_context_get_server_info (_tmp0_, _sound_services_volume_control_pulse_server_info_cb_for_props_pa_server_info_cb_t, self);
	_tmp2_ = _tmp1_;
	_pa_operation_unref0 (_tmp2_);
}

static void
_sound_services_volume_control_pulse_source_info_cb_pa_source_info_cb_t (pa_context* c,
                                                                         pa_source_info* i,
                                                                         gint eol,
                                                                         gpointer self)
{
	sound_services_volume_control_pulse_source_info_cb ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
sound_services_volume_control_pulse_update_source_get_server_info_cb (SoundServicesVolumeControlPulse* self,
                                                                      pa_context* c,
                                                                      pa_server_info* i)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i != NULL) {
		pa_context* _tmp0_;
		const gchar* _tmp1_;
		pa_operation* _tmp2_;
		pa_operation* _tmp3_;
		_tmp0_ = self->priv->context;
		_tmp1_ = (*i).default_source_name;
		_tmp2_ = pa_context_get_source_info_by_name (_tmp0_, _tmp1_, _sound_services_volume_control_pulse_source_info_cb_pa_source_info_cb_t, self);
		_tmp3_ = _tmp2_;
		_pa_operation_unref0 (_tmp3_);
	}
}

static void
_sound_services_volume_control_pulse_update_source_get_server_info_cb_pa_server_info_cb_t (pa_context* c,
                                                                                           pa_server_info* i,
                                                                                           gpointer self)
{
	sound_services_volume_control_pulse_update_source_get_server_info_cb ((SoundServicesVolumeControlPulse*) self, c, i);
}

static void
sound_services_volume_control_pulse_update_source (SoundServicesVolumeControlPulse* self)
{
	pa_context* _tmp0_;
	pa_operation* _tmp1_;
	pa_operation* _tmp2_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->context;
	_tmp1_ = pa_context_get_server_info (_tmp0_, _sound_services_volume_control_pulse_update_source_get_server_info_cb_pa_server_info_cb_t, self);
	_tmp2_ = _tmp1_;
	_pa_operation_unref0 (_tmp2_);
}

static gboolean
_vala_string_array_contains (gchar* * stack,
                             gssize stack_length,
                             const gchar* needle)
{
	gssize i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}

static void
sound_services_volume_control_pulse_add_sink_input_into_list (SoundServicesVolumeControlPulse* self,
                                                              pa_sink_input_info* sink_input)
{
	gchar* role = NULL;
	pa_sink_input_info _tmp0_;
	pa_proplist* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	const gchar* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (sink_input != NULL);
	_tmp0_ = *sink_input;
	_tmp1_ = _tmp0_.proplist;
	_tmp2_ = pa_proplist_gets (_tmp1_, PA_PROP_MEDIA_ROLE);
	_tmp3_ = g_strdup (_tmp2_);
	role = _tmp3_;
	_tmp5_ = role;
	if (_tmp5_ != NULL) {
		const gchar* _tmp6_;
		gchar** _tmp7_;
		gint _tmp7__length1;
		_tmp6_ = role;
		_tmp7_ = self->priv->_valid_roles;
		_tmp7__length1 = self->priv->_valid_roles_length1;
		_tmp4_ = _vala_string_array_contains (_tmp7_, _tmp7__length1, _tmp6_);
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		const gchar* _tmp8_;
		_tmp8_ = role;
		if (g_strcmp0 (_tmp8_, "phone") == 0) {
			GeeArrayList* _tmp9_;
			pa_sink_input_info _tmp10_;
			const gchar* _tmp11_;
			const gchar* _tmp12_;
			GQuark _tmp14_ = 0U;
			static GQuark _tmp13_label0 = 0;
			static GQuark _tmp13_label1 = 0;
			static GQuark _tmp13_label2 = 0;
			static GQuark _tmp13_label3 = 0;
			gboolean _tmp27_ = FALSE;
			_tmp9_ = self->priv->_sink_input_list;
			_tmp10_ = *sink_input;
			gee_abstract_list_insert ((GeeAbstractList*) _tmp9_, 0, (gpointer) ((guintptr) _tmp10_.index));
			_tmp11_ = role;
			_tmp12_ = _tmp11_;
			_tmp14_ = (NULL == _tmp12_) ? 0 : g_quark_from_string (_tmp12_);
			if (_tmp14_ == ((0 != _tmp13_label0) ? _tmp13_label0 : (_tmp13_label0 = g_quark_from_static_string ("multimedia")))) {
				switch (0) {
					default:
					{
						GeeHashMap* _tmp15_;
						pa_sink_input_info _tmp16_;
						const gchar* _tmp17_;
						_tmp15_ = self->priv->_sink_input_hash;
						_tmp16_ = *sink_input;
						_tmp17_ = self->priv->_objp_role_multimedia;
						gee_abstract_map_set ((GeeAbstractMap*) _tmp15_, (gpointer) ((guintptr) _tmp16_.index), _tmp17_);
						break;
					}
				}
			} else if (_tmp14_ == ((0 != _tmp13_label1) ? _tmp13_label1 : (_tmp13_label1 = g_quark_from_static_string ("alert")))) {
				switch (0) {
					default:
					{
						GeeHashMap* _tmp18_;
						pa_sink_input_info _tmp19_;
						const gchar* _tmp20_;
						_tmp18_ = self->priv->_sink_input_hash;
						_tmp19_ = *sink_input;
						_tmp20_ = self->priv->_objp_role_alert;
						gee_abstract_map_set ((GeeAbstractMap*) _tmp18_, (gpointer) ((guintptr) _tmp19_.index), _tmp20_);
						break;
					}
				}
			} else if (_tmp14_ == ((0 != _tmp13_label2) ? _tmp13_label2 : (_tmp13_label2 = g_quark_from_static_string ("alarm")))) {
				switch (0) {
					default:
					{
						GeeHashMap* _tmp21_;
						pa_sink_input_info _tmp22_;
						const gchar* _tmp23_;
						_tmp21_ = self->priv->_sink_input_hash;
						_tmp22_ = *sink_input;
						_tmp23_ = self->priv->_objp_role_alarm;
						gee_abstract_map_set ((GeeAbstractMap*) _tmp21_, (gpointer) ((guintptr) _tmp22_.index), _tmp23_);
						break;
					}
				}
			} else if (_tmp14_ == ((0 != _tmp13_label3) ? _tmp13_label3 : (_tmp13_label3 = g_quark_from_static_string ("phone")))) {
				switch (0) {
					default:
					{
						GeeHashMap* _tmp24_;
						pa_sink_input_info _tmp25_;
						const gchar* _tmp26_;
						_tmp24_ = self->priv->_sink_input_hash;
						_tmp25_ = *sink_input;
						_tmp26_ = self->priv->_objp_role_phone;
						gee_abstract_map_set ((GeeAbstractMap*) _tmp24_, (gpointer) ((guintptr) _tmp25_.index), _tmp26_);
						break;
					}
				}
			}
			if (self->priv->_active_sink_input == ((gint32) -1)) {
				_tmp27_ = TRUE;
			} else {
				GeeHashMap* _tmp28_;
				gpointer _tmp29_;
				gchar* _tmp30_;
				const gchar* _tmp31_;
				_tmp28_ = self->priv->_sink_input_hash;
				_tmp29_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp28_, (gpointer) ((guintptr) self->priv->_active_sink_input));
				_tmp30_ = (gchar*) _tmp29_;
				_tmp31_ = self->priv->_objp_role_phone;
				_tmp27_ = g_strcmp0 (_tmp30_, _tmp31_) != 0;
				_g_free0 (_tmp30_);
			}
			if (_tmp27_) {
				pa_sink_input_info _tmp32_;
				_tmp32_ = *sink_input;
				sound_services_volume_control_pulse_update_active_sink_input (self, (gint32) _tmp32_.index, NULL, NULL);
			}
		}
	}
	_g_free0 (role);
}

static void
sound_services_volume_control_pulse_remove_sink_input_from_list (SoundServicesVolumeControlPulse* self,
                                                                 guint32 index)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_sink_input_list;
	if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp0_, (gpointer) ((guintptr) index))) {
		GeeArrayList* _tmp1_;
		GeeHashMap* _tmp2_;
		_tmp1_ = self->priv->_sink_input_list;
		gee_abstract_collection_remove ((GeeAbstractCollection*) _tmp1_, (gpointer) ((guintptr) index));
		_tmp2_ = self->priv->_sink_input_hash;
		gee_abstract_map_unset ((GeeAbstractMap*) _tmp2_, (gpointer) ((guintptr) index), NULL);
		if (index == ((guint32) self->priv->_active_sink_input)) {
			GeeArrayList* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			_tmp3_ = self->priv->_sink_input_list;
			_tmp4_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp3_);
			_tmp5_ = _tmp4_;
			if (_tmp5_ != 0) {
				GeeArrayList* _tmp6_;
				gpointer _tmp7_;
				_tmp6_ = self->priv->_sink_input_list;
				_tmp7_ = gee_abstract_list_get ((GeeAbstractList*) _tmp6_, 0);
				sound_services_volume_control_pulse_update_active_sink_input (self, (gint32) ((guint32) ((guintptr) _tmp7_)), NULL, NULL);
			} else {
				sound_services_volume_control_pulse_update_active_sink_input (self, (gint32) -1, NULL, NULL);
			}
		}
	}
}

static void
sound_services_volume_control_pulse_handle_new_sink_input_cb (SoundServicesVolumeControlPulse* self,
                                                              pa_context* c,
                                                              pa_sink_input_info* i,
                                                              gint eol)
{
	pa_sink_input_info _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		return;
	}
	_tmp0_ = *i;
	sound_services_volume_control_pulse_add_sink_input_into_list (self, &_tmp0_);
}

static void
sound_services_volume_control_pulse_handle_changed_sink_input_cb (SoundServicesVolumeControlPulse* self,
                                                                  pa_context* c,
                                                                  pa_sink_input_info* i,
                                                                  gint eol)
{
	GeeArrayList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		return;
	}
	_tmp0_ = self->priv->_sink_input_list;
	if (gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp0_, (gpointer) ((guintptr) (*i).index))) {
		GeeHashMap* _tmp1_;
		gpointer _tmp2_;
		gchar* _tmp3_;
		const gchar* _tmp4_;
		gboolean _tmp5_;
		_tmp1_ = self->priv->_sink_input_hash;
		_tmp2_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp1_, (gpointer) ((guintptr) (*i).index));
		_tmp3_ = (gchar*) _tmp2_;
		_tmp4_ = self->priv->_objp_role_phone;
		_tmp5_ = g_strcmp0 (_tmp3_, _tmp4_) != 0;
		_g_free0 (_tmp3_);
		if (_tmp5_) {
			sound_services_volume_control_pulse_remove_sink_input_from_list (self, (*i).index);
		}
	} else {
		pa_sink_input_info _tmp6_;
		_tmp6_ = *i;
		sound_services_volume_control_pulse_add_sink_input_into_list (self, &_tmp6_);
	}
}

static void
sound_services_volume_control_pulse_source_output_info_cb (SoundServicesVolumeControlPulse* self,
                                                           pa_context* c,
                                                           pa_source_output_info* i,
                                                           gint eol)
{
	gchar* role = NULL;
	pa_proplist* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gboolean _tmp3_ = FALSE;
	const gchar* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		return;
	}
	_tmp0_ = (*i).proplist;
	_tmp1_ = pa_proplist_gets (_tmp0_, PA_PROP_MEDIA_ROLE);
	_tmp2_ = g_strdup (_tmp1_);
	role = _tmp2_;
	_tmp4_ = role;
	if (g_strcmp0 (_tmp4_, "phone") == 0) {
		_tmp3_ = TRUE;
	} else {
		const gchar* _tmp5_;
		_tmp5_ = role;
		_tmp3_ = g_strcmp0 (_tmp5_, "production") == 0;
	}
	if (_tmp3_) {
		sound_services_volume_control_set_active_mic ((SoundServicesVolumeControl*) self, TRUE);
	}
	_g_free0 (role);
}

static void
_sound_services_volume_control_pulse_context_events_cb_pa_context_subscribe_cb_t (pa_context* c,
                                                                                  pa_subscription_event_type_t t,
                                                                                  guint32 idx,
                                                                                  gpointer self)
{
	sound_services_volume_control_pulse_context_events_cb ((SoundServicesVolumeControlPulse*) self, c, t, idx);
}

static gboolean
_sound_services_volume_control_pulse_reconnect_timeout_gsource_func (gpointer self)
{
	gboolean result;
	result = sound_services_volume_control_pulse_reconnect_timeout ((SoundServicesVolumeControlPulse*) self);
	return result;
}

static void
sound_services_volume_control_pulse_context_state_callback (SoundServicesVolumeControlPulse* self,
                                                            pa_context* c)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	switch (pa_context_get_state (c)) {
		case PA_CONTEXT_READY:
		{
			if (self->priv->_pulse_use_stream_restore) {
				pa_operation* _tmp0_;
				pa_operation* _tmp1_;
				_tmp0_ = pa_context_subscribe (c, ((PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SINK_INPUT) | PA_SUBSCRIPTION_MASK_SOURCE) | PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, NULL, NULL);
				_tmp1_ = _tmp0_;
				_pa_operation_unref0 (_tmp1_);
			} else {
				pa_operation* _tmp2_;
				pa_operation* _tmp3_;
				_tmp2_ = pa_context_subscribe (c, (PA_SUBSCRIPTION_MASK_SINK | PA_SUBSCRIPTION_MASK_SOURCE) | PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, NULL, NULL);
				_tmp3_ = _tmp2_;
				_pa_operation_unref0 (_tmp3_);
			}
			pa_context_set_subscribe_callback (c, _sound_services_volume_control_pulse_context_events_cb_pa_context_subscribe_cb_t, self);
			sound_services_volume_control_pulse_update_sink (self);
			sound_services_volume_control_pulse_update_source (self);
			sound_services_volume_control_set_ready ((SoundServicesVolumeControl*) self, TRUE);
			break;
		}
		case PA_CONTEXT_FAILED:
		case PA_CONTEXT_TERMINATED:
		{
			if (self->priv->_reconnect_timer == ((guint) 0)) {
				self->priv->_reconnect_timer = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 2, _sound_services_volume_control_pulse_reconnect_timeout_gsource_func, g_object_ref (self), g_object_unref);
			}
			break;
		}
		default:
		{
			sound_services_volume_control_set_ready ((SoundServicesVolumeControl*) self, FALSE);
			break;
		}
	}
}

static gboolean
sound_services_volume_control_pulse_reconnect_timeout (SoundServicesVolumeControlPulse* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->_reconnect_timer = (guint) 0;
	sound_services_volume_control_pulse_reconnect_to_pulse (self, NULL, NULL);
	result = FALSE;
	return result;
}

static void
sound_services_volume_control_pulse_reconnect_to_pulse_data_free (gpointer _data)
{
	SoundServicesVolumeControlPulseReconnectToPulseData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (SoundServicesVolumeControlPulseReconnectToPulseData, _data_);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static void
sound_services_volume_control_pulse_reconnect_to_pulse (SoundServicesVolumeControlPulse* self,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_)
{
	SoundServicesVolumeControlPulseReconnectToPulseData* _data_;
	SoundServicesVolumeControlPulse* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SoundServicesVolumeControlPulseReconnectToPulseData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sound_services_volume_control_pulse_reconnect_to_pulse_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	sound_services_volume_control_pulse_reconnect_to_pulse_co (_data_);
}

static void
sound_services_volume_control_pulse_reconnect_to_pulse_finish (SoundServicesVolumeControlPulse* self,
                                                               GAsyncResult* _res_)
{
	SoundServicesVolumeControlPulseReconnectToPulseData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
_sound_services_volume_control_pulse_context_state_callback_pa_context_notify_cb_t (pa_context* c,
                                                                                    gpointer self)
{
	sound_services_volume_control_pulse_context_state_callback ((SoundServicesVolumeControlPulse*) self, c);
}

static gboolean
sound_services_volume_control_pulse_reconnect_to_pulse_co (SoundServicesVolumeControlPulseReconnectToPulseData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = sound_services_volume_control_get_ready ((SoundServicesVolumeControl*) _data_->self);
	_data_->_tmp1_ = _data_->_tmp0_;
	if (_data_->_tmp1_) {
		_data_->_tmp2_ = _data_->self->priv->context;
		pa_context_disconnect (_data_->_tmp2_);
		_pa_context_unref0 (_data_->self->priv->context);
		_data_->self->priv->context = NULL;
		sound_services_volume_control_set_ready ((SoundServicesVolumeControl*) _data_->self, FALSE);
	}
	_data_->_tmp3_ = pa_proplist_new ();
	_data_->props = _data_->_tmp3_;
	_data_->_tmp4_ = _data_->props;
	pa_proplist_sets (_data_->_tmp4_, PA_PROP_APPLICATION_NAME, "elementary OS Audio Settings");
	_data_->_tmp5_ = _data_->props;
	pa_proplist_sets (_data_->_tmp5_, PA_PROP_APPLICATION_ID, "io.elementary.desktop.wingpanel.sound");
	_data_->_tmp6_ = _data_->props;
	pa_proplist_sets (_data_->_tmp6_, PA_PROP_APPLICATION_ICON_NAME, "multimedia-volume-control");
	_data_->_tmp7_ = _data_->props;
	pa_proplist_sets (_data_->_tmp7_, PA_PROP_APPLICATION_VERSION, "0.1");
	_data_->_tmp8_ = sound_services_volume_control_pulse_loop;
	_data_->_tmp9_ = pa_glib_mainloop_get_api (_data_->_tmp8_);
	_data_->_tmp10_ = _data_->props;
	_data_->_tmp11_ = pa_context_new_with_proplist (_data_->_tmp9_, NULL, _data_->_tmp10_);
	_pa_context_unref0 (_data_->self->priv->context);
	_data_->self->priv->context = _data_->_tmp11_;
	_data_->_tmp12_ = _data_->self->priv->context;
	pa_context_set_state_callback (_data_->_tmp12_, _sound_services_volume_control_pulse_context_state_callback_pa_context_notify_cb_t, _data_->self);
	_data_->_tmp13_ = _data_->self->priv->context;
	if (pa_context_connect (_data_->_tmp13_, NULL, PA_CONTEXT_NOFAIL, NULL) < 0) {
		_data_->_tmp14_ = _data_->self->priv->context;
		_data_->_tmp15_ = pa_strerror (pa_context_errno (_data_->_tmp14_));
		g_warning ("Volume-control.vala:478: pa_context_connect() failed: %s\n", _data_->_tmp15_);
	}
	_pa_proplist_free0 (_data_->props);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static void
sound_services_volume_control_pulse_sink_info_list_callback_set_mute (SoundServicesVolumeControlPulse* self,
                                                                      pa_context* context,
                                                                      pa_sink_info* sink,
                                                                      gint eol)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	if (sink != NULL) {
		pa_operation* _tmp0_;
		pa_operation* _tmp1_;
		_tmp0_ = pa_context_set_sink_mute_by_index (context, (*sink).index, TRUE, NULL, NULL);
		_tmp1_ = _tmp0_;
		_pa_operation_unref0 (_tmp1_);
	}
}

static void
sound_services_volume_control_pulse_sink_info_list_callback_unset_mute (SoundServicesVolumeControlPulse* self,
                                                                        pa_context* context,
                                                                        pa_sink_info* sink,
                                                                        gint eol)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	if (sink != NULL) {
		pa_operation* _tmp0_;
		pa_operation* _tmp1_;
		_tmp0_ = pa_context_set_sink_mute_by_index (context, (*sink).index, FALSE, NULL, NULL);
		_tmp1_ = _tmp0_;
		_pa_operation_unref0 (_tmp1_);
	}
}

static void
_sound_services_volume_control_pulse_sink_info_list_callback_set_mute_pa_sink_info_cb_t (pa_context* c,
                                                                                         pa_sink_info* i,
                                                                                         gint eol,
                                                                                         gpointer self)
{
	sound_services_volume_control_pulse_sink_info_list_callback_set_mute ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
_sound_services_volume_control_pulse_sink_info_list_callback_unset_mute_pa_sink_info_cb_t (pa_context* c,
                                                                                           pa_sink_info* i,
                                                                                           gint eol,
                                                                                           gpointer self)
{
	sound_services_volume_control_pulse_sink_info_list_callback_unset_mute ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static gboolean
sound_services_volume_control_pulse_set_mute_internal (SoundServicesVolumeControlPulse* self,
                                                       gboolean mute)
{
	pa_context* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->context;
	g_return_val_if_fail (pa_context_get_state (_tmp0_) == PA_CONTEXT_READY, FALSE);
	if (self->priv->_mute != mute) {
		if (mute) {
			pa_context* _tmp1_;
			pa_operation* _tmp2_;
			pa_operation* _tmp3_;
			_tmp1_ = self->priv->context;
			_tmp2_ = pa_context_get_sink_info_list (_tmp1_, _sound_services_volume_control_pulse_sink_info_list_callback_set_mute_pa_sink_info_cb_t, self);
			_tmp3_ = _tmp2_;
			_pa_operation_unref0 (_tmp3_);
		} else {
			pa_context* _tmp4_;
			pa_operation* _tmp5_;
			pa_operation* _tmp6_;
			_tmp4_ = self->priv->context;
			_tmp5_ = pa_context_get_sink_info_list (_tmp4_, _sound_services_volume_control_pulse_sink_info_list_callback_unset_mute_pa_sink_info_cb_t, self);
			_tmp6_ = _tmp5_;
			_pa_operation_unref0 (_tmp6_);
		}
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

static void
sound_services_volume_control_pulse_real_set_mute (SoundServicesVolumeControl* base,
                                                   gboolean mute)
{
	SoundServicesVolumeControlPulse * self;
	self = (SoundServicesVolumeControlPulse*) base;
	sound_services_volume_control_pulse_set_mute_internal (self, mute);
}

void
sound_services_volume_control_pulse_toggle_mute (SoundServicesVolumeControlPulse* self)
{
	g_return_if_fail (self != NULL);
	sound_services_volume_control_set_mute ((SoundServicesVolumeControl*) self, !self->priv->_mute);
}

static void
sound_services_volume_control_pulse_source_info_list_callback_set_mute (SoundServicesVolumeControlPulse* self,
                                                                        pa_context* context,
                                                                        pa_source_info* source,
                                                                        gint eol)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	if (source != NULL) {
		_tmp0_ = (*source).monitor_of_sink == ((guint32) -1);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		pa_operation* _tmp1_;
		pa_operation* _tmp2_;
		_tmp1_ = pa_context_set_source_mute_by_index (context, (*source).index, TRUE, NULL, NULL);
		_tmp2_ = _tmp1_;
		_pa_operation_unref0 (_tmp2_);
	}
}

static void
sound_services_volume_control_pulse_source_info_list_callback_unset_mute (SoundServicesVolumeControlPulse* self,
                                                                          pa_context* context,
                                                                          pa_source_info* source,
                                                                          gint eol)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (context != NULL);
	if (source != NULL) {
		_tmp0_ = (*source).monitor_of_sink == ((guint32) -1);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		pa_operation* _tmp1_;
		pa_operation* _tmp2_;
		_tmp1_ = pa_context_set_source_mute_by_index (context, (*source).index, FALSE, NULL, NULL);
		_tmp2_ = _tmp1_;
		_pa_operation_unref0 (_tmp2_);
	}
}

static void
_sound_services_volume_control_pulse_source_info_list_callback_set_mute_pa_source_info_cb_t (pa_context* c,
                                                                                             pa_source_info* i,
                                                                                             gint eol,
                                                                                             gpointer self)
{
	sound_services_volume_control_pulse_source_info_list_callback_set_mute ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
_sound_services_volume_control_pulse_source_info_list_callback_unset_mute_pa_source_info_cb_t (pa_context* c,
                                                                                               pa_source_info* i,
                                                                                               gint eol,
                                                                                               gpointer self)
{
	sound_services_volume_control_pulse_source_info_list_callback_unset_mute ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static gboolean
sound_services_volume_control_pulse_set_mic_mute_internal (SoundServicesVolumeControlPulse* self,
                                                           gboolean m)
{
	pa_context* _tmp0_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->context;
	g_return_val_if_fail (pa_context_get_state (_tmp0_) == PA_CONTEXT_READY, FALSE);
	if (self->priv->_mute_mic != m) {
		if (m) {
			pa_context* _tmp1_;
			pa_operation* _tmp2_;
			pa_operation* _tmp3_;
			_tmp1_ = self->priv->context;
			_tmp2_ = pa_context_get_source_info_list (_tmp1_, _sound_services_volume_control_pulse_source_info_list_callback_set_mute_pa_source_info_cb_t, self);
			_tmp3_ = _tmp2_;
			_pa_operation_unref0 (_tmp3_);
		} else {
			pa_context* _tmp4_;
			pa_operation* _tmp5_;
			pa_operation* _tmp6_;
			_tmp4_ = self->priv->context;
			_tmp5_ = pa_context_get_source_info_list (_tmp4_, _sound_services_volume_control_pulse_source_info_list_callback_unset_mute_pa_source_info_cb_t, self);
			_tmp6_ = _tmp5_;
			_pa_operation_unref0 (_tmp6_);
		}
		result = TRUE;
		return result;
	} else {
		result = FALSE;
		return result;
	}
}

void
sound_services_volume_control_pulse_set_mic_mute (SoundServicesVolumeControlPulse* self,
                                                  gboolean m)
{
	g_return_if_fail (self != NULL);
	sound_services_volume_control_pulse_set_mic_mute_internal (self, m);
}

void
sound_services_volume_control_pulse_toggle_mic_mute (SoundServicesVolumeControlPulse* self)
{
	g_return_if_fail (self != NULL);
	sound_services_volume_control_pulse_set_mic_mute (self, !self->priv->_mute_mic);
}

static pa_volume_t
sound_services_volume_control_pulse_double_to_volume (gdouble vol)
{
	gdouble tmp = 0.0;
	pa_volume_t result;
	tmp = ((gdouble) (PA_VOLUME_NORM - PA_VOLUME_MUTED)) * vol;
	result = ((pa_volume_t) tmp) + PA_VOLUME_MUTED;
	return result;
}

static gdouble
sound_services_volume_control_pulse_volume_to_double (pa_volume_t vol)
{
	gdouble tmp = 0.0;
	gdouble result;
	tmp = (gdouble) (vol - PA_VOLUME_MUTED);
	result = tmp / ((gdouble) (PA_VOLUME_NORM - PA_VOLUME_MUTED));
	return result;
}

static void
sound_services_volume_control_pulse_set_volume_success_cb (SoundServicesVolumeControlPulse* self,
                                                           pa_context* c,
                                                           gint success)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if ((gboolean) success) {
		g_object_notify ((GObject*) self, "volume");
	}
}

static void
_sound_services_volume_control_pulse_set_volume_success_cb_pa_context_success_cb_t (pa_context* c,
                                                                                    gint success,
                                                                                    gpointer self)
{
	sound_services_volume_control_pulse_set_volume_success_cb ((SoundServicesVolumeControlPulse*) self, c, success);
}

static void
sound_services_volume_control_pulse_sink_info_set_volume_cb (SoundServicesVolumeControlPulse* self,
                                                             pa_context* c,
                                                             pa_sink_info* i,
                                                             gint eol)
{
	pa_cvolume cvol = {0};
	pa_cvolume _tmp0_;
	SoundServicesVolumeControlVolume* _tmp1_;
	pa_cvolume _tmp2_;
	pa_operation* _tmp3_;
	pa_operation* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		return;
	}
	_tmp0_ = (*i).volume;
	cvol = _tmp0_;
	_tmp1_ = self->priv->_volume;
	pa_cvolume_scale (&cvol, sound_services_volume_control_pulse_double_to_volume (_tmp1_->volume));
	_tmp2_ = cvol;
	_tmp3_ = pa_context_set_sink_volume_by_index (c, (*i).index, &_tmp2_, _sound_services_volume_control_pulse_set_volume_success_cb_pa_context_success_cb_t, self);
	_tmp4_ = _tmp3_;
	_pa_operation_unref0 (_tmp4_);
}

static void
_sound_services_volume_control_pulse_sink_info_set_volume_cb_pa_sink_info_cb_t (pa_context* c,
                                                                                pa_sink_info* i,
                                                                                gint eol,
                                                                                gpointer self)
{
	sound_services_volume_control_pulse_sink_info_set_volume_cb ((SoundServicesVolumeControlPulse*) self, c, i, eol);
}

static void
sound_services_volume_control_pulse_server_info_cb_for_set_volume (SoundServicesVolumeControlPulse* self,
                                                                   pa_context* c,
                                                                   pa_server_info* i)
{
	pa_context* _tmp0_;
	const gchar* _tmp1_;
	pa_operation* _tmp2_;
	pa_operation* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i == NULL) {
		g_warning ("Volume-control.vala:598: Could not get PulseAudio server info");
		return;
	}
	_tmp0_ = self->priv->context;
	_tmp1_ = (*i).default_sink_name;
	_tmp2_ = pa_context_get_sink_info_by_name (_tmp0_, _tmp1_, _sound_services_volume_control_pulse_sink_info_set_volume_cb_pa_sink_info_cb_t, self);
	_tmp3_ = _tmp2_;
	_pa_operation_unref0 (_tmp3_);
}

static void
sound_services_volume_control_pulse_set_mic_volume_success_cb (SoundServicesVolumeControlPulse* self,
                                                               pa_context* c,
                                                               gint success)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if ((gboolean) success) {
		g_object_notify ((GObject*) self, "mic-volume");
	}
}

static void
_sound_services_volume_control_pulse_set_mic_volume_success_cb_pa_context_success_cb_t (pa_context* c,
                                                                                        gint success,
                                                                                        gpointer self)
{
	sound_services_volume_control_pulse_set_mic_volume_success_cb ((SoundServicesVolumeControlPulse*) self, c, success);
}

static void
sound_services_volume_control_pulse_set_mic_volume_get_server_info_cb (SoundServicesVolumeControlPulse* self,
                                                                       pa_context* c,
                                                                       pa_server_info* i)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (c != NULL);
	if (i != NULL) {
		pa_cvolume cvol = {0};
		pa_cvolume _tmp0_;
		const gchar* _tmp1_;
		pa_cvolume _tmp2_;
		pa_operation* _tmp3_;
		pa_operation* _tmp4_;
		pa_cvolume_init (&cvol);
		_tmp0_ = cvol;
		cvol = *pa_cvolume_set (&_tmp0_, (guint) 1, sound_services_volume_control_pulse_double_to_volume (self->priv->_mic_volume));
		_tmp1_ = (*i).default_source_name;
		_tmp2_ = cvol;
		_tmp3_ = pa_context_set_source_volume_by_name (c, _tmp1_, &_tmp2_, _sound_services_volume_control_pulse_set_mic_volume_success_cb_pa_context_success_cb_t, self);
		_tmp4_ = _tmp3_;
		_pa_operation_unref0 (_tmp4_);
	}
}

static void
sound_services_volume_control_pulse_update_active_sink_input_data_free (gpointer _data)
{
	SoundServicesVolumeControlPulseUpdateActiveSinkInputData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (SoundServicesVolumeControlPulseUpdateActiveSinkInputData, _data_);
}

static void
sound_services_volume_control_pulse_update_active_sink_input (SoundServicesVolumeControlPulse* self,
                                                              gint32 index,
                                                              GAsyncReadyCallback _callback_,
                                                              gpointer _user_data_)
{
	SoundServicesVolumeControlPulseUpdateActiveSinkInputData* _data_;
	SoundServicesVolumeControlPulse* _tmp0_;
	g_return_if_fail (self != NULL);
	_data_ = g_slice_new0 (SoundServicesVolumeControlPulseUpdateActiveSinkInputData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, sound_services_volume_control_pulse_update_active_sink_input_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->index = index;
	sound_services_volume_control_pulse_update_active_sink_input_co (_data_);
}

static void
sound_services_volume_control_pulse_update_active_sink_input_finish (SoundServicesVolumeControlPulse* self,
                                                                     GAsyncResult* _res_)
{
	SoundServicesVolumeControlPulseUpdateActiveSinkInputData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static gboolean
sound_services_volume_control_pulse_update_active_sink_input_co (SoundServicesVolumeControlPulseUpdateActiveSinkInputData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static gboolean
_sound_services_volume_control_pulse_local_volume_changed_timeout_gsource_func (gpointer self)
{
	gboolean result;
	result = sound_services_volume_control_pulse_local_volume_changed_timeout ((SoundServicesVolumeControlPulse*) self);
	return result;
}

static void
sound_services_volume_control_pulse_start_local_volume_timer (SoundServicesVolumeControlPulse* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_local_volume_timer == ((guint) 0)) {
		self->priv->_local_volume_timer = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, _sound_services_volume_control_pulse_local_volume_changed_timeout_gsource_func, g_object_ref (self), g_object_unref);
	} else {
		self->priv->_send_next_local_volume = TRUE;
	}
}

static void
sound_services_volume_control_pulse_stop_local_volume_timer (SoundServicesVolumeControlPulse* self)
{
	g_return_if_fail (self != NULL);
	if (self->priv->_local_volume_timer != ((guint) 0)) {
		g_source_remove (self->priv->_local_volume_timer);
		self->priv->_local_volume_timer = (guint) 0;
	}
}

static gboolean
sound_services_volume_control_pulse_local_volume_changed_timeout (SoundServicesVolumeControlPulse* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->_local_volume_timer = (guint) 0;
	if (self->priv->_send_next_local_volume) {
		self->priv->_send_next_local_volume = FALSE;
		sound_services_volume_control_pulse_start_local_volume_timer (self);
	}
	result = FALSE;
	return result;
}

static const gchar*
sound_services_volume_control_pulse_real_get_stream (SoundServicesVolumeControl* base)
{
	const gchar* result;
	SoundServicesVolumeControlPulse* self;
	gchar* path = NULL;
	GeeHashMap* _tmp0_;
	gpointer _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	self = (SoundServicesVolumeControlPulse*) base;
	if (self->priv->_active_sink_input == ((gint32) -1)) {
		result = "alert";
		return result;
	}
	_tmp0_ = self->priv->_sink_input_hash;
	_tmp1_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp0_, (gpointer) ((guintptr) self->priv->_active_sink_input));
	path = (gchar*) _tmp1_;
	_tmp2_ = path;
	_tmp3_ = self->priv->_objp_role_multimedia;
	if (g_strcmp0 (_tmp2_, _tmp3_) == 0) {
		result = "multimedia";
		_g_free0 (path);
		return result;
	}
	_tmp4_ = path;
	_tmp5_ = self->priv->_objp_role_alert;
	if (g_strcmp0 (_tmp4_, _tmp5_) == 0) {
		result = "alert";
		_g_free0 (path);
		return result;
	}
	_tmp6_ = path;
	_tmp7_ = self->priv->_objp_role_alarm;
	if (g_strcmp0 (_tmp6_, _tmp7_) == 0) {
		result = "alarm";
		_g_free0 (path);
		return result;
	}
	_tmp8_ = path;
	_tmp9_ = self->priv->_objp_role_phone;
	if (g_strcmp0 (_tmp8_, _tmp9_) == 0) {
		result = "phone";
		_g_free0 (path);
		return result;
	}
	result = "alert";
	_g_free0 (path);
	return result;
}

static gboolean
sound_services_volume_control_pulse_real_get_ready (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControlPulse* self;
	self = (SoundServicesVolumeControlPulse*) base;
	result = self->priv->_ready;
	return result;
}

static void
sound_services_volume_control_pulse_real_set_ready (SoundServicesVolumeControl* base,
                                                    gboolean value)
{
	SoundServicesVolumeControlPulse* self;
	gboolean old_value;
	self = (SoundServicesVolumeControlPulse*) base;
	old_value = sound_services_volume_control_pulse_real_get_ready (base);
	if (old_value != value) {
		self->priv->_ready = value;
		g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_READY_PROPERTY]);
	}
}

static gboolean
sound_services_volume_control_pulse_real_get_active_mic (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControlPulse* self;
	self = (SoundServicesVolumeControlPulse*) base;
	result = self->priv->_active_mic;
	return result;
}

static void
sound_services_volume_control_pulse_real_set_active_mic (SoundServicesVolumeControl* base,
                                                         gboolean value)
{
	SoundServicesVolumeControlPulse* self;
	gboolean old_value;
	self = (SoundServicesVolumeControlPulse*) base;
	old_value = sound_services_volume_control_pulse_real_get_active_mic (base);
	if (old_value != value) {
		self->priv->_active_mic = value;
		g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_ACTIVE_MIC_PROPERTY]);
	}
}

static gboolean
sound_services_volume_control_pulse_real_get_high_volume (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControlPulse* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	SoundServicesVolumeControlVolume* _tmp2_;
	self = (SoundServicesVolumeControlPulse*) base;
	_tmp2_ = self->priv->_volume;
	if (_tmp2_->volume > 0.75) {
		gboolean _tmp3_;
		gboolean _tmp4_;
		_tmp3_ = sound_services_volume_control_get_headphone_plugged ((SoundServicesVolumeControl*) self);
		_tmp4_ = _tmp3_;
		_tmp1_ = _tmp4_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		_tmp5_ = sound_services_volume_control_get_stream ((SoundServicesVolumeControl*) self);
		_tmp6_ = _tmp5_;
		_tmp0_ = g_strcmp0 (_tmp6_, "multimedia") == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
sound_services_volume_control_pulse_real_get_mute (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControlPulse* self;
	self = (SoundServicesVolumeControlPulse*) base;
	result = self->priv->_mute;
	return result;
}

gboolean
sound_services_volume_control_pulse_get_micMute (SoundServicesVolumeControlPulse* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_mute_mic;
	return result;
}

static gboolean
sound_services_volume_control_pulse_real_get_is_playing (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControlPulse* self;
	self = (SoundServicesVolumeControlPulse*) base;
	result = self->priv->_is_playing;
	return result;
}

static gboolean
sound_services_volume_control_pulse_real_get_is_listening (SoundServicesVolumeControl* base)
{
	gboolean result;
	SoundServicesVolumeControlPulse* self;
	self = (SoundServicesVolumeControlPulse*) base;
	result = self->priv->_is_listening;
	return result;
}

static SoundServicesVolumeControlVolume*
sound_services_volume_control_pulse_real_get_volume (SoundServicesVolumeControl* base)
{
	SoundServicesVolumeControlVolume* result;
	SoundServicesVolumeControlPulse* self;
	SoundServicesVolumeControlVolume* _tmp0_;
	self = (SoundServicesVolumeControlPulse*) base;
	_tmp0_ = self->priv->_volume;
	result = _tmp0_;
	return result;
}

static void
_sound_services_volume_control_pulse_server_info_cb_for_set_volume_pa_server_info_cb_t (pa_context* c,
                                                                                        pa_server_info* i,
                                                                                        gpointer self)
{
	sound_services_volume_control_pulse_server_info_cb_for_set_volume ((SoundServicesVolumeControlPulse*) self, c, i);
}

static void
sound_services_volume_control_pulse_real_set_volume (SoundServicesVolumeControl* base,
                                                     SoundServicesVolumeControlVolume* value)
{
	SoundServicesVolumeControlPulse* self;
	gboolean volume_changed = FALSE;
	SoundServicesVolumeControlVolume* _tmp0_;
	gboolean old_high_volume = FALSE;
	gboolean _tmp1_;
	gboolean _tmp2_;
	SoundServicesVolumeControlVolume* _tmp3_;
	gboolean _tmp4_ = FALSE;
	gboolean _tmp5_ = FALSE;
	pa_context* _tmp6_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	gboolean _tmp13_ = FALSE;
	SoundServicesVolumeControlVolume* _tmp14_;
	SoundServicesVolumeControlVolume* _tmp15_;
	self = (SoundServicesVolumeControlPulse*) base;
	_tmp0_ = self->priv->_volume;
	volume_changed = value->volume != _tmp0_->volume;
	g_debug ("Volume-control.vala:655: Setting volume to %f for profile %d because %" \
"d", value->volume, (gint) self->priv->_active_sink_input, (gint) value->reason);
	_tmp1_ = sound_services_volume_control_get_high_volume ((SoundServicesVolumeControl*) self);
	_tmp2_ = _tmp1_;
	old_high_volume = _tmp2_;
	_tmp3_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_volume);
	self->priv->_volume = _tmp3_;
	_tmp6_ = self->priv->context;
	if (pa_context_get_state (_tmp6_) == PA_CONTEXT_READY) {
		SoundServicesVolumeControlVolume* _tmp7_;
		_tmp7_ = self->priv->_volume;
		_tmp5_ = _tmp7_->reason != SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_PULSE_CHANGE;
	} else {
		_tmp5_ = FALSE;
	}
	if (_tmp5_) {
		_tmp4_ = volume_changed;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		pa_context* _tmp8_;
		pa_operation* _tmp9_;
		pa_operation* _tmp10_;
		_tmp8_ = self->priv->context;
		_tmp9_ = pa_context_get_server_info (_tmp8_, _sound_services_volume_control_pulse_server_info_cb_for_set_volume_pa_server_info_cb_t, self);
		_tmp10_ = _tmp9_;
		_pa_operation_unref0 (_tmp10_);
	}
	_tmp11_ = sound_services_volume_control_get_high_volume ((SoundServicesVolumeControl*) self);
	_tmp12_ = _tmp11_;
	if (_tmp12_ != old_high_volume) {
		g_object_notify ((GObject*) self, "high-volume");
	}
	_tmp14_ = sound_services_volume_control_get_volume ((SoundServicesVolumeControl*) self);
	_tmp15_ = _tmp14_;
	if (_tmp15_->reason != SOUND_SERVICES_VOLUME_CONTROL_VOLUME_REASONS_ACCOUNTS_SERVICE_SET) {
		_tmp13_ = volume_changed;
	} else {
		_tmp13_ = FALSE;
	}
	if (_tmp13_) {
		sound_services_volume_control_pulse_start_local_volume_timer (self);
	}
	g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_VOLUME_PROPERTY]);
}

static gdouble
sound_services_volume_control_pulse_real_get_mic_volume (SoundServicesVolumeControl* base)
{
	gdouble result;
	SoundServicesVolumeControlPulse* self;
	self = (SoundServicesVolumeControlPulse*) base;
	result = self->priv->_mic_volume;
	return result;
}

static void
_sound_services_volume_control_pulse_set_mic_volume_get_server_info_cb_pa_server_info_cb_t (pa_context* c,
                                                                                            pa_server_info* i,
                                                                                            gpointer self)
{
	sound_services_volume_control_pulse_set_mic_volume_get_server_info_cb ((SoundServicesVolumeControlPulse*) self, c, i);
}

static void
sound_services_volume_control_pulse_real_set_mic_volume (SoundServicesVolumeControl* base,
                                                         gdouble value)
{
	SoundServicesVolumeControlPulse* self;
	pa_context* _tmp0_;
	pa_context* _tmp1_;
	pa_operation* _tmp2_;
	pa_operation* _tmp3_;
	self = (SoundServicesVolumeControlPulse*) base;
	_tmp0_ = self->priv->context;
	g_return_if_fail (pa_context_get_state (_tmp0_) == PA_CONTEXT_READY);
	self->priv->_mic_volume = value;
	_tmp1_ = self->priv->context;
	_tmp2_ = pa_context_get_server_info (_tmp1_, _sound_services_volume_control_pulse_set_mic_volume_get_server_info_cb_pa_server_info_cb_t, self);
	_tmp3_ = _tmp2_;
	_pa_operation_unref0 (_tmp3_);
	g_object_notify_by_pspec ((GObject *) self, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_VOLUME_PROPERTY]);
}

static void
sound_services_volume_control_pulse_class_init (SoundServicesVolumeControlPulseClass * klass,
                                                gpointer klass_data)
{
	sound_services_volume_control_pulse_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &SoundServicesVolumeControlPulse_private_offset);
	((SoundServicesVolumeControlClass *) klass)->set_mute = (void (*) (SoundServicesVolumeControl*, gboolean)) sound_services_volume_control_pulse_real_set_mute;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_stream = (const gchar* (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_stream;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_ready = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_ready;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_ready = (void (*) (SoundServicesVolumeControl*, gboolean)) sound_services_volume_control_pulse_real_set_ready;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_active_mic = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_active_mic;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_active_mic = (void (*) (SoundServicesVolumeControl*, gboolean)) sound_services_volume_control_pulse_real_set_active_mic;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_high_volume = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_high_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_mute = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_mute;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_is_playing = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_is_playing;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_is_listening = (gboolean (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_is_listening;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_volume = (SoundServicesVolumeControlVolume* (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_volume = (void (*) (SoundServicesVolumeControl*, SoundServicesVolumeControlVolume*)) sound_services_volume_control_pulse_real_set_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->get_mic_volume = (gdouble (*) (SoundServicesVolumeControl*)) sound_services_volume_control_pulse_real_get_mic_volume;
	SOUND_SERVICES_VOLUME_CONTROL_CLASS (klass)->set_mic_volume = (void (*) (SoundServicesVolumeControl*, gdouble)) sound_services_volume_control_pulse_real_set_mic_volume;
	G_OBJECT_CLASS (klass)->get_property = _vala_sound_services_volume_control_pulse_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_sound_services_volume_control_pulse_set_property;
	G_OBJECT_CLASS (klass)->finalize = sound_services_volume_control_pulse_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_STREAM_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_STREAM_PROPERTY] = g_param_spec_string ("stream", "stream", "stream", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	/** true when connected to the pulse server */
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_READY_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_READY_PROPERTY] = g_param_spec_boolean ("ready", "ready", "ready", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/** true when a microphone is active **/
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_ACTIVE_MIC_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_ACTIVE_MIC_PROPERTY] = g_param_spec_boolean ("active-mic", "active-mic", "active-mic", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	/** true when high volume warnings should be shown */
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_HIGH_VOLUME_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_HIGH_VOLUME_PROPERTY] = g_param_spec_boolean ("high-volume", "high-volume", "high-volume", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_MUTE_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_MUTE_PROPERTY] = g_param_spec_boolean ("mute", "mute", "mute", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_MUTE_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_MUTE_PROPERTY] = g_param_spec_boolean ("micMute", "micMute", "micMute", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_PLAYING_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_PLAYING_PROPERTY] = g_param_spec_boolean ("is-playing", "is-playing", "is-playing", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_LISTENING_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_LISTENING_PROPERTY] = g_param_spec_boolean ("is-listening", "is-listening", "is-listening", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_VOLUME_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_VOLUME_PROPERTY] = g_param_spec_object ("volume", "volume", "volume", SOUND_SERVICES_VOLUME_CONTROL_TYPE_VOLUME, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_VOLUME_PROPERTY, sound_services_volume_control_pulse_properties[SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_VOLUME_PROPERTY] = g_param_spec_double ("mic-volume", "mic-volume", "mic-volume", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
sound_services_volume_control_pulse_instance_init (SoundServicesVolumeControlPulse * self,
                                                   gpointer klass)
{
	SoundServicesVolumeControlVolume* _tmp0_;
	GeeArrayList* _tmp1_;
	GeeHashMap* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	self->priv = sound_services_volume_control_pulse_get_instance_private (self);
	self->priv->_reconnect_timer = (guint) 0;
	self->priv->_mute = TRUE;
	self->priv->_mute_mic = TRUE;
	self->priv->_is_playing = FALSE;
	self->priv->_is_listening = FALSE;
	_tmp0_ = sound_services_volume_control_volume_new ();
	self->priv->_volume = _tmp0_;
	self->priv->_mic_volume = 0.0;
	_tmp1_ = gee_array_list_new (G_TYPE_UINT, NULL, NULL, NULL, NULL, NULL);
	self->priv->_sink_input_list = _tmp1_;
	_tmp2_ = gee_hash_map_new (G_TYPE_UINT, NULL, NULL, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	self->priv->_sink_input_hash = _tmp2_;
	self->priv->_pulse_use_stream_restore = FALSE;
	self->priv->_active_sink_input = (gint32) -1;
	_tmp3_ = g_strdup ("multimedia");
	_tmp4_ = g_strdup ("alert");
	_tmp5_ = g_strdup ("alarm");
	_tmp6_ = g_strdup ("phone");
	_tmp7_ = g_new0 (gchar*, 4 + 1);
	_tmp7_[0] = _tmp3_;
	_tmp7_[1] = _tmp4_;
	_tmp7_[2] = _tmp5_;
	_tmp7_[3] = _tmp6_;
	self->priv->_valid_roles = _tmp7_;
	self->priv->_valid_roles_length1 = 4;
	self->priv->__valid_roles_size_ = self->priv->_valid_roles_length1;
	self->priv->_objp_role_multimedia = NULL;
	self->priv->_objp_role_alert = NULL;
	self->priv->_objp_role_alarm = NULL;
	self->priv->_objp_role_phone = NULL;
	self->priv->_local_volume_timer = (guint) 0;
	self->priv->_send_next_local_volume = FALSE;
	self->priv->_active_mic = FALSE;
}

static void
sound_services_volume_control_pulse_finalize (GObject * obj)
{
	SoundServicesVolumeControlPulse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, SOUND_SERVICES_TYPE_VOLUME_CONTROL_PULSE, SoundServicesVolumeControlPulse);
	if (self->priv->_reconnect_timer != ((guint) 0)) {
		g_source_remove (self->priv->_reconnect_timer);
		self->priv->_reconnect_timer = (guint) 0;
	}
	sound_services_volume_control_pulse_stop_local_volume_timer (self);
	_pa_context_unref0 (self->priv->context);
	_g_object_unref0 (self->priv->_volume);
	_g_object_unref0 (self->priv->_sink_input_list);
	_g_object_unref0 (self->priv->_sink_input_hash);
	self->priv->_valid_roles = (_vala_array_free (self->priv->_valid_roles, self->priv->_valid_roles_length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (self->priv->_objp_role_multimedia);
	_g_free0 (self->priv->_objp_role_alert);
	_g_free0 (self->priv->_objp_role_alarm);
	_g_free0 (self->priv->_objp_role_phone);
	_g_object_unref0 (self->priv->_mute_cancellable);
	_g_object_unref0 (self->priv->_volume_cancellable);
	G_OBJECT_CLASS (sound_services_volume_control_pulse_parent_class)->finalize (obj);
}

static GType
sound_services_volume_control_pulse_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (SoundServicesVolumeControlPulseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) sound_services_volume_control_pulse_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SoundServicesVolumeControlPulse), 0, (GInstanceInitFunc) sound_services_volume_control_pulse_instance_init, NULL };
	GType sound_services_volume_control_pulse_type_id;
	sound_services_volume_control_pulse_type_id = g_type_register_static (SOUND_SERVICES_TYPE_VOLUME_CONTROL, "SoundServicesVolumeControlPulse", &g_define_type_info, 0);
	SoundServicesVolumeControlPulse_private_offset = g_type_add_instance_private (sound_services_volume_control_pulse_type_id, sizeof (SoundServicesVolumeControlPulsePrivate));
	return sound_services_volume_control_pulse_type_id;
}

GType
sound_services_volume_control_pulse_get_type (void)
{
	static volatile gsize sound_services_volume_control_pulse_type_id__once = 0;
	if (g_once_init_enter (&sound_services_volume_control_pulse_type_id__once)) {
		GType sound_services_volume_control_pulse_type_id;
		sound_services_volume_control_pulse_type_id = sound_services_volume_control_pulse_get_type_once ();
		g_once_init_leave (&sound_services_volume_control_pulse_type_id__once, sound_services_volume_control_pulse_type_id);
	}
	return sound_services_volume_control_pulse_type_id__once;
}

static void
_vala_sound_services_volume_control_pulse_get_property (GObject * object,
                                                        guint property_id,
                                                        GValue * value,
                                                        GParamSpec * pspec)
{
	SoundServicesVolumeControlPulse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SOUND_SERVICES_TYPE_VOLUME_CONTROL_PULSE, SoundServicesVolumeControlPulse);
	switch (property_id) {
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_STREAM_PROPERTY:
		g_value_set_string (value, sound_services_volume_control_get_stream ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_READY_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_ready ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_ACTIVE_MIC_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_active_mic ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_HIGH_VOLUME_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_high_volume ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_MUTE_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_mute ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_MUTE_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_pulse_get_micMute (self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_PLAYING_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_is_playing ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_IS_LISTENING_PROPERTY:
		g_value_set_boolean (value, sound_services_volume_control_get_is_listening ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_VOLUME_PROPERTY:
		g_value_set_object (value, sound_services_volume_control_get_volume ((SoundServicesVolumeControl*) self));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_VOLUME_PROPERTY:
		g_value_set_double (value, sound_services_volume_control_get_mic_volume ((SoundServicesVolumeControl*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_sound_services_volume_control_pulse_set_property (GObject * object,
                                                        guint property_id,
                                                        const GValue * value,
                                                        GParamSpec * pspec)
{
	SoundServicesVolumeControlPulse * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, SOUND_SERVICES_TYPE_VOLUME_CONTROL_PULSE, SoundServicesVolumeControlPulse);
	switch (property_id) {
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_READY_PROPERTY:
		sound_services_volume_control_set_ready ((SoundServicesVolumeControl*) self, g_value_get_boolean (value));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_ACTIVE_MIC_PROPERTY:
		sound_services_volume_control_set_active_mic ((SoundServicesVolumeControl*) self, g_value_get_boolean (value));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_VOLUME_PROPERTY:
		sound_services_volume_control_set_volume ((SoundServicesVolumeControl*) self, g_value_get_object (value));
		break;
		case SOUND_SERVICES_VOLUME_CONTROL_PULSE_MIC_VOLUME_PROPERTY:
		sound_services_volume_control_set_mic_volume ((SoundServicesVolumeControl*) self, g_value_get_double (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

