diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-02-18 16:22:58 +0000 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-02-18 16:22:58 +0000 |
commit | 5882cc24cda26ab021224c66abf579b6b603617b (patch) | |
tree | 3d72715c49d3fdba026bd765cc846d0e3b91b23a /src | |
parent | fca4da8d8a9dd24d8abdf2a92cf19a0c6d596e48 (diff) | |
download | ayatana-indicator-sound-5882cc24cda26ab021224c66abf579b6b603617b.tar.gz ayatana-indicator-sound-5882cc24cda26ab021224c66abf579b6b603617b.tar.bz2 ayatana-indicator-sound-5882cc24cda26ab021224c66abf579b6b603617b.zip |
and unmutes on slider activation
Diffstat (limited to 'src')
-rw-r--r-- | src/pulseaudio-mgr.c | 10 | ||||
-rw-r--r-- | src/pulseaudio-mgr.h | 1 | ||||
-rw-r--r-- | src/voip-input-menu-item.c | 22 |
3 files changed, 24 insertions, 9 deletions
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c index 8f7a290..e319793 100644 --- a/src/pulseaudio-mgr.c +++ b/src/pulseaudio-mgr.c @@ -175,6 +175,15 @@ pm_update_mic_gain (gint source_index, pa_cvolume new_gain) NULL) ); } +void +pm_update_mic_mute (gint source_index, gint mute_update) +{ + pa_operation_unref (pa_context_set_source_mute_by_index (pulse_context, + source_index, + mute_update, + NULL, + NULL)); +} /**********************************************************************************************************************/ // Pulse-Audio asychronous call-backs /**********************************************************************************************************************/ @@ -258,6 +267,7 @@ pm_subscribed_events_callback (pa_context *c, } + static void pm_context_state_callback (pa_context *c, void *userdata) { diff --git a/src/pulseaudio-mgr.h b/src/pulseaudio-mgr.h index a93cf92..d61117d 100644 --- a/src/pulseaudio-mgr.h +++ b/src/pulseaudio-mgr.h @@ -23,6 +23,7 @@ void pm_establish_pulse_connection (ActiveSink* active_sink); void close_pulse_activites(); void pm_update_volume (gint sink_index, pa_cvolume new_volume); void pm_update_mic_gain (gint source_index, pa_cvolume new_gain); +void pm_update_mic_mute (gint source_index, int mute_update); void pm_update_mute (gboolean update); diff --git a/src/voip-input-menu-item.c b/src/voip-input-menu-item.c index 337420b..19bc92d 100644 --- a/src/voip-input-menu-item.c +++ b/src/voip-input-menu-item.c @@ -85,7 +85,7 @@ voip_input_menu_item_init (VoipInputMenuItem *self) priv->source_index = DEVICE_NOT_ACTIVE; priv->sink_input_index = DEVICE_NOT_ACTIVE; priv->client_index = DEVICE_NOT_ACTIVE; - priv->mute = 0; + priv->mute = DEVICE_NOT_ACTIVE; } static void @@ -125,6 +125,10 @@ handle_event (DbusmenuMenuitem * mi, pa_cvolume_set(&new_volume, 1, new_volume_value); pm_update_mic_gain (priv->source_index, new_volume); + // finally unmute if needed + if (priv->mute == 1) { + pm_update_mic_mute (priv->source_index, 0); + } //active_sink_update_volume (priv->a_sink, volume_input); //active_sink_ensure_sink_is_unmuted (priv->a_sink); } @@ -155,8 +159,15 @@ voip_input_menu_item_update (VoipInputMenuItem* item, priv->source_index = source->index; } priv->volume = voip_input_menu_item_construct_mono_volume (&source->volume); - + pa_volume_t vol = pa_cvolume_max (&source->volume); + gdouble update = ((gdouble) vol * 100) / PA_VOLUME_NORM; + + GVariant* new_volume = g_variant_new_double(update); + dbusmenu_menuitem_property_set_variant(DBUSMENU_MENUITEM(item), + DBUSMENU_VOIP_INPUT_MENUITEM_LEVEL, + new_volume); // Only send over the mute updates if the state has changed. + // in this order - volume first mute last!! if (priv->mute != source->mute){ g_debug ("voip menu item - update - mute = %i", priv->mute); @@ -168,13 +179,6 @@ voip_input_menu_item_update (VoipInputMenuItem* item, priv->mute = source->mute; - pa_volume_t vol = pa_cvolume_max (&source->volume); - gdouble update = ((gdouble) vol * 100) / PA_VOLUME_NORM; - - GVariant* new_volume = g_variant_new_double(update); - dbusmenu_menuitem_property_set_variant(DBUSMENU_MENUITEM(item), - DBUSMENU_VOIP_INPUT_MENUITEM_LEVEL, - new_volume); } gboolean |