aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConor Curran <conor.curran@canonical.com>2011-02-17 19:58:09 +0000
committerConor Curran <conor.curran@canonical.com>2011-02-17 19:58:09 +0000
commit8263f9aed8c1c66cfe7a7749a4d78c096165acd3 (patch)
tree7f066486d0aa1bbe57c47ba3482acfe28ab72482
parent4bebcafef41b3dbc6b4f3f3e2f6382d82390335f (diff)
downloadayatana-indicator-sound-8263f9aed8c1c66cfe7a7749a4d78c096165acd3.tar.gz
ayatana-indicator-sound-8263f9aed8c1c66cfe7a7749a4d78c096165acd3.tar.bz2
ayatana-indicator-sound-8263f9aed8c1c66cfe7a7749a4d78c096165acd3.zip
enough for one day
-rw-r--r--src/pulseaudio-mgr.c20
-rw-r--r--src/pulseaudio-mgr.h1
-rw-r--r--src/voip-input-menu-item.c12
-rw-r--r--src/voip-input-widget.c3
4 files changed, 28 insertions, 8 deletions
diff --git a/src/pulseaudio-mgr.c b/src/pulseaudio-mgr.c
index 211933b..1cfe7af 100644
--- a/src/pulseaudio-mgr.c
+++ b/src/pulseaudio-mgr.c
@@ -19,9 +19,9 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
/**Notes
*
- * Approach now is to set up the communication channels then query the server
- * fetch its default sink. If this fails then fetch the list of sinks and take
- * the first one which is not the auto-null sink.
+ * Approach now is to set up the communication channels, query the server
+ * fetch its default sink/source. If this fails then fetch the list of sinks/sources
+ * and take the first one which is not the auto-null sink.
* TODO: need to handle the situation where one chink in this linear chain breaks
* i.e. start off the process again and count the attempts (note different to
reconnect attempts)
@@ -165,6 +165,16 @@ pm_update_mute (gboolean update)
GINT_TO_POINTER (update)));
}
+void
+pm_update_mic_gain (gint source_index, pa_cvolume new_gain)
+{
+ pa_operation_unref (pa_context_set_source_volume_by_index (pulse_context,
+ source_index,
+ &new_gain,
+ NULL,
+ NULL) );
+}
+
/**********************************************************************************************************************/
// Pulse-Audio asychronous call-backs
/**********************************************************************************************************************/
@@ -217,10 +227,12 @@ pm_subscribed_events_callback (pa_context *c,
break;
case PA_SUBSCRIPTION_EVENT_SINK_INPUT:
// We don't care about sink input removals.
+ g_debug ("sink input event");
if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_REMOVE) {
- g_debug ("Just saw a sink input removal event");
+ g_debug ("Just saw a sink input removal event - index = %i", index);
}
else if ((t & PA_SUBSCRIPTION_EVENT_TYPE_MASK) == PA_SUBSCRIPTION_EVENT_NEW) {
+ g_debug ("some new sink input event ? - index = %i", index);
// Determine if its a VOIP app or a maybe blocking state.
pa_operation_unref (pa_context_get_sink_input_info (c,
index,
diff --git a/src/pulseaudio-mgr.h b/src/pulseaudio-mgr.h
index c0ab9c0..a93cf92 100644
--- a/src/pulseaudio-mgr.h
+++ b/src/pulseaudio-mgr.h
@@ -22,6 +22,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
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_mute (gboolean update);
diff --git a/src/voip-input-menu-item.c b/src/voip-input-menu-item.c
index 203fed4..54e12e6 100644
--- a/src/voip-input-menu-item.c
+++ b/src/voip-input-menu-item.c
@@ -23,6 +23,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib/gi18n.h>
#include "voip-input-menu-item.h"
#include "common-defs.h"
+#include "pulseaudio-mgr.h"
typedef struct _VoipInputMenuItemPrivate VoipInputMenuItemPrivate;
@@ -107,11 +108,18 @@ handle_event (DbusmenuMenuitem * mi,
input = g_variant_get_variant(value);
}
- gboolean volume_input = g_variant_get_double(input);
+ gboolean percent = g_variant_get_double(input);
if (value != NULL){
if (IS_VOIP_INPUT_MENU_ITEM (mi)) {
VoipInputMenuItemPrivate* priv = VOIP_INPUT_MENU_ITEM_GET_PRIVATE (VOIP_INPUT_MENU_ITEM (mi));
- g_debug ("Handle event in the voip input level backend instance - %f", volume_input);
+ g_debug ("Handle event in the voip input level backend instance - %f", percent);
+ pa_cvolume new_volume;
+ pa_cvolume_init(&new_volume);
+ new_volume.channels = 1;
+ pa_volume_t new_volume_value = (pa_volume_t) ((percent * PA_VOLUME_NORM) / 100);
+ pa_cvolume_set(&new_volume, 1, new_volume_value);
+
+ pm_update_mic_gain (priv->index, new_volume);
//active_sink_update_volume (priv->a_sink, volume_input);
//active_sink_ensure_sink_is_unmuted (priv->a_sink);
}
diff --git a/src/voip-input-widget.c b/src/voip-input-widget.c
index 5ce7601..fa58d21 100644
--- a/src/voip-input-widget.c
+++ b/src/voip-input-widget.c
@@ -28,7 +28,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "voip-input-widget.h"
#include "common-defs.h"
#include <libido/idoscalemenuitem.h>
-//#include "indicator-sound.h"
typedef struct _VoipInputWidgetPrivate VoipInputWidgetPrivate;
@@ -102,7 +101,7 @@ voip_input_widget_init (VoipInputWidget *self)
g_object_unref(primary_gicon);
GtkWidget* secondary_image = ido_scale_menu_item_get_secondary_image((IdoScaleMenuItem*)priv->ido_voip_input_slider);
- GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks("audio-volume-high-panel");
+ GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks("audio-input-microphone");
gtk_image_set_from_gicon(GTK_IMAGE(secondary_image), secondary_gicon, GTK_ICON_SIZE_MENU);
g_object_unref(secondary_gicon);