aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-call-window.c
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-03-04 01:34:41 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-03-04 01:34:41 +0800
commit937bed8acb966613630e10ae83aebfacb1a52af0 (patch)
tree2ecd60a66d6113fe2a79ad42dfbc44d3b372f390 /src/empathy-call-window.c
parent62dfae4bf6a967076140a1625dfc7b41d1cac3e5 (diff)
downloadgsoc2013-empathy-937bed8acb966613630e10ae83aebfacb1a52af0.tar
gsoc2013-empathy-937bed8acb966613630e10ae83aebfacb1a52af0.tar.gz
gsoc2013-empathy-937bed8acb966613630e10ae83aebfacb1a52af0.tar.bz2
gsoc2013-empathy-937bed8acb966613630e10ae83aebfacb1a52af0.tar.lz
gsoc2013-empathy-937bed8acb966613630e10ae83aebfacb1a52af0.tar.xz
gsoc2013-empathy-937bed8acb966613630e10ae83aebfacb1a52af0.tar.zst
gsoc2013-empathy-937bed8acb966613630e10ae83aebfacb1a52af0.zip
Hook up audio input panel
Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk> svn path=/trunk/; revision=2561
Diffstat (limited to 'src/empathy-call-window.c')
-rw-r--r--src/empathy-call-window.c40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 0c10c8d5c..7bdeb08cc 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -22,6 +22,8 @@
#include <stdio.h>
#include <stdlib.h>
+#include <math.h>
+
#include <gst/gst.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
@@ -285,28 +287,60 @@ empathy_call_window_create_video_input (EmpathyCallWindow *self)
return hbox;
}
+static void
+empathy_call_window_mic_volume_changed_cb (GtkAdjustment *adj,
+ EmpathyCallWindow *self)
+{
+ EmpathyCallWindowPriv *priv = GET_PRIV (self);
+
+ empathy_audio_src_set_volume (EMPATHY_GST_AUDIO_SRC (priv->audio_input),
+ gtk_adjustment_get_value (adj)/100);
+}
+
+static void
+empathy_call_window_audio_input_level_changed_cb (EmpathyGstAudioSrc *src,
+ gdouble level, GtkProgressBar *bar)
+{
+ gdouble value;
+
+ value = CLAMP (pow (10, level / 20), 0.0, 1.0);
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (bar), value);
+}
+
static GtkWidget *
empathy_call_window_create_audio_input (EmpathyCallWindow *self)
{
+ EmpathyCallWindowPriv *priv = GET_PRIV (self);
GtkWidget *hbox, *vbox, *scale, *progress, *label;
+ GtkAdjustment *adj;
hbox = gtk_hbox_new (TRUE, 3);
vbox = gtk_vbox_new (FALSE, 3);
gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 3);
- scale = gtk_vscale_new_with_range (0, 100, 10);
+ scale = gtk_vscale_new_with_range (0, 150, 100);
gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
label = gtk_label_new (_("Volume"));
+ adj = gtk_range_get_adjustment (GTK_RANGE (scale));
+ gtk_adjustment_set_value (adj,
+ empathy_audio_src_get_volume (
+ EMPATHY_GST_AUDIO_SRC (priv->audio_input)) * 100);
+
+ g_signal_connect (G_OBJECT (adj), "value-changed",
+ G_CALLBACK (empathy_call_window_mic_volume_changed_cb), self);
+
gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 3);
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 3);
-
progress = gtk_progress_bar_new ();
gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (progress),
GTK_PROGRESS_BOTTOM_TO_TOP);
- gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0.5);
+ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), 0);
+
+ g_signal_connect (priv->audio_input, "peak-level-changed",
+ G_CALLBACK (empathy_call_window_audio_input_level_changed_cb), progress);
gtk_box_pack_start (GTK_BOX (hbox), progress, FALSE, FALSE, 3);