r2741 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src

alphaone at sita.openmoko.org alphaone at sita.openmoko.org
Sun Aug 19 19:36:17 CEST 2007


Author: alphaone
Date: 2007-08-19 19:36:16 +0200 (Sun, 19 Aug 2007)
New Revision: 2741

Added:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h
Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c
Log:
2007-08-19  Daniel Willmann  <daniel at totalueberwachung.de>
  * src/moko-sound.{c,h}: Created functions to switch the audio profiles
  * src/Makefile.am, src/moko-talking.c: Switch audio profiles when
    accepting/initiating or cancelling a call


Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-19 13:14:37 UTC (rev 2740)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-19 17:36:16 UTC (rev 2741)
@@ -1,3 +1,8 @@
+2007-08-19  Daniel Willmann  <daniel at totalueberwachung.de>
+	* src/moko-sound.{c,h}: Created functions to switch the audio profiles
+	* src/Makefile.am, src/moko-talking.c: Switch audio profiles when
+	accepting/initiating or cancelling a call
+
 2007-08-16  Neil J. Patel  <njp at o-hand.com>
 
 	* src/moko-dialer.c: (on_keypad_pin_entry),

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-08-19 13:14:37 UTC (rev 2740)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-08-19 17:36:16 UTC (rev 2741)
@@ -25,7 +25,9 @@
 	moko-notify.c			\
 	moko-notify.h			\
 	moko-talking.c			\
-	moko-talking.h
+	moko-talking.h			\
+	moko-sound.c			\
+	moko-sound.h
 
 
 openmoko_dialer_LDADD = @LIBS@

Added: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c	2007-08-19 13:14:37 UTC (rev 2740)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.c	2007-08-19 17:36:16 UTC (rev 2741)
@@ -0,0 +1,40 @@
+/*
+ *  moko-sound; Crude hack to switch audio profiles until we have a proper solution
+ *
+ *  by Daniel Willmann <daniel at totalueberwachung.de>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Lesser Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include "moko-dialer.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+
+char *sound_profile_filenames[] = { "/etc/gsmhandset.state",
+  "/etc/gsmheadset.state",
+  "/etc/stereoout.state" };
+
+void moko_sound_profile_set(int profile) {
+  char command[100];
+  snprintf(command, 100, "alsactl -f %s restore", sound_profile_filenames[profile]);
+  system(command);
+}
+
+void moko_sound_profile_save(int profile) {
+  char command[100];
+  snprintf(command, 100, "alsactl -f %s store", sound_profile_filenames[profile]);
+  system(command);
+}
+

Added: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h	2007-08-19 13:14:37 UTC (rev 2740)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-sound.h	2007-08-19 17:36:16 UTC (rev 2741)
@@ -0,0 +1,30 @@
+/*
+ *  moko-sound; Crude hack to switch audio profiles until we have a proper solution
+ *
+ *  by Daniel Willmann <daniel at totalueberwachung.de>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Lesser Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _HAVE_MOKO_SOUND_H
+#define _HAVE_MOKO_SOUND_H
+
+enum { SOUND_PROFILE_GSM_HANDSET,
+SOUND_PROFILE_GSM_HEADSET,
+SOUND_PROFILE_STEREO_OUT };
+
+void moko_sound_profile_set(int profile);
+void moko_sound_profile_save(int profile);
+
+#endif /* _HAVE_MOKO_SOUND_H */

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c	2007-08-19 13:14:37 UTC (rev 2740)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-talking.c	2007-08-19 17:36:16 UTC (rev 2741)
@@ -21,6 +21,7 @@
 
 #include <moko-journal.h>
 
+#include "moko-sound.h"
 #include "moko-talking.h"
 
 G_DEFINE_TYPE (MokoTalking, moko_talking, GTK_TYPE_VBOX)
@@ -168,6 +169,8 @@
   gtk_widget_hide (priv->incoming_bar);
   gtk_widget_show (priv->main_bar);
 
+  moko_sound_profile_set(SOUND_PROFILE_GSM_HANDSET);
+
   if (entry)
     markup = g_strdup_printf ("<b>%s</b>\n%s", entry->contact->name, number);
   else
@@ -224,6 +227,8 @@
   gtk_widget_hide (priv->incoming_bar);
   gtk_widget_show (priv->main_bar);
 
+  moko_sound_profile_set(SOUND_PROFILE_GSM_HANDSET);
+
   if (entry)
     markup = g_strdup_printf ("<b>%s</b>\n%s", entry->contact->name, number);
   else
@@ -263,6 +268,7 @@
 on_cancel_clicked (GtkToolButton *button, MokoTalking *talking)
 {
   g_source_remove (talking->priv->timeout);
+  moko_sound_profile_set(SOUND_PROFILE_STEREO_OUT);
   g_signal_emit (G_OBJECT (talking), talking_signals[CANCEL_CALL], 0);
 }
 





More information about the commitlog mailing list