diff options
Diffstat (limited to 'src/pulse-manager.c')
-rw-r--r-- | src/pulse-manager.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/src/pulse-manager.c b/src/pulse-manager.c index 8fa47eb..52f9cba 100644 --- a/src/pulse-manager.c +++ b/src/pulse-manager.c @@ -92,16 +92,6 @@ static void destroy_sink_info(void *value) g_free(sink); } -/*static void test_hash(){*/ -/* guint size = 0;*/ -/* size = g_hash_table_size(sink_hash);*/ -/* g_debug("Size of hash = %i", size);*/ -/* sink_info *s = g_hash_table_lookup(sink_hash, GINT_TO_POINTER(DEFAULT_SINK_INDEX)); */ -/* g_debug("The name of our sink is %s", s->name); */ -/* g_debug("and the max volume is %f", (gdouble)s->base_volume); */ - -/*}*/ - /* Controllers & Utilities */ @@ -256,9 +246,6 @@ static void pulse_sink_info_callback(pa_context *c, const pa_sink_info *sink, in if(device_available == TRUE) { update_pa_state(TRUE, device_available, default_sink_is_muted(), get_default_sink_volume()); - //sound_service_dbus_update_sink_volume(dbus_service, get_default_sink_volume()); - //sound_service_dbus_update_sink_mute(dbus_service, default_sink_is_muted()); - //g_debug("default sink index : %d", DEFAULT_SINK_INDEX); } else{ //Update the indicator to show PA either is not ready or has no available sink @@ -346,8 +333,8 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v s->description = g_strdup(info->description); s->icon_name = g_strdup(pa_proplist_gets(info->proplist, PA_PROP_DEVICE_ICON_NAME)); s->active_port = (info->active_port != NULL); - s->mute = !!info->mute; gboolean mute_changed = s->mute != !!info->mute; + s->mute = !!info->mute; gboolean volume_changed = (pa_cvolume_equal(&info->volume, &s->volume) == 0); s->volume = info->volume; s->base_volume = info->base_volume; @@ -362,9 +349,19 @@ static void update_sink_info(pa_context *c, const pa_sink_info *info, int eol, v g_debug("Updating volume from PA manager with volume = %f", volume_percent); sound_service_dbus_update_sink_volume(dbus_service, volume_percent); } - if (mute_changed == TRUE) + + if (mute_changed == TRUE) + { + g_debug("Updating Mute from PA manager with mute = %i", s->mute); sound_service_dbus_update_sink_mute(dbus_service, s->mute); - update_mute_ui(s->mute); + update_mute_ui(s->mute); + if(s->mute == FALSE){ + pa_volume_t vol = pa_cvolume_avg(&s->volume); + gdouble volume_percent = ((gdouble) vol * 100) / PA_VOLUME_NORM; + g_debug("Updating volume from PA manager with volume = %f", volume_percent); + sound_service_dbus_update_sink_volume(dbus_service, volume_percent); + } + } } } else |