summaryrefslogtreecommitdiff
path: root/navit/speech
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-05-18 10:01:53 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-05-18 10:01:53 +0000
commit0b74d7f4ee6d448ac811e2741e8cb1ed04f5ce76 (patch)
treebe7bb1cb1020f4022e41c004e2fa9d561ea3580d /navit/speech
parentf46eb419c46011d6d103b7f06cb2c842a2cbe6c9 (diff)
downloadnavit-0b74d7f4ee6d448ac811e2741e8cb1ed04f5ce76.tar.gz
Fix:Core:Renamed src to navit for cleanup of includes
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@1059 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/speech')
-rw-r--r--navit/speech/Makefile.am4
-rw-r--r--navit/speech/cmdline/Makefile.am4
-rw-r--r--navit/speech/cmdline/speech_cmdline.c47
-rw-r--r--navit/speech/speech_dispatcher/Makefile.am6
-rw-r--r--navit/speech/speech_dispatcher/speech_speech_dispatcher.c67
5 files changed, 128 insertions, 0 deletions
diff --git a/navit/speech/Makefile.am b/navit/speech/Makefile.am
new file mode 100644
index 000000000..b0ee9f5d0
--- /dev/null
+++ b/navit/speech/Makefile.am
@@ -0,0 +1,4 @@
+SUBDIRS=cmdline
+if SPEECH_SPEECH_DISPATCHER
+ SUBDIRS += speech_dispatcher
+endif
diff --git a/navit/speech/cmdline/Makefile.am b/navit/speech/cmdline/Makefile.am
new file mode 100644
index 000000000..592990c28
--- /dev/null
+++ b/navit/speech/cmdline/Makefile.am
@@ -0,0 +1,4 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=speech_cmdline
+modulespeech_LTLIBRARIES = libspeech_cmdline.la
+libspeech_cmdline_la_SOURCES = speech_cmdline.c
diff --git a/navit/speech/cmdline/speech_cmdline.c b/navit/speech/cmdline/speech_cmdline.c
new file mode 100644
index 000000000..df3b9f127
--- /dev/null
+++ b/navit/speech/cmdline/speech_cmdline.c
@@ -0,0 +1,47 @@
+#include <stdlib.h>
+#include <glib.h>
+#include "config.h"
+#include "plugin.h"
+#include "speech.h"
+
+struct speech_priv {
+ char *cmdline;
+};
+
+static int
+speechd_say(struct speech_priv *this, const char *text)
+{
+ char *cmdline;
+
+ cmdline=g_strdup_printf(this->cmdline, text);
+ return system(cmdline);
+}
+
+static void
+speechd_destroy(struct speech_priv *this) {
+ g_free(this->cmdline);
+ g_free(this);
+}
+
+static struct speech_methods speechd_meth = {
+ speechd_destroy,
+ speechd_say,
+};
+
+static struct speech_priv *
+speechd_new(char *data, struct speech_methods *meth) {
+ struct speech_priv *this;
+ if (! data)
+ return NULL;
+ this=g_new(struct speech_priv,1);
+ this->cmdline=g_strdup(data);
+ *meth=speechd_meth;
+ return this;
+}
+
+
+void
+plugin_init(void)
+{
+ plugin_register_speech_type("cmdline", speechd_new);
+}
diff --git a/navit/speech/speech_dispatcher/Makefile.am b/navit/speech/speech_dispatcher/Makefile.am
new file mode 100644
index 000000000..3980e90f1
--- /dev/null
+++ b/navit/speech/speech_dispatcher/Makefile.am
@@ -0,0 +1,6 @@
+include $(top_srcdir)/Makefile.inc
+AM_CPPFLAGS = @NAVIT_CFLAGS@ -I$(top_srcdir)/src -DMODULE=speech_speech_dispatcher
+modulespeech_LTLIBRARIES = libspeech_speech_dispatcher.la
+libspeech_speech_dispatcher_la_SOURCES = speech_speech_dispatcher.c
+libspeech_speech_dispatcher_la_LIBADD = @SPEECHD_LIBS@
+
diff --git a/navit/speech/speech_dispatcher/speech_speech_dispatcher.c b/navit/speech/speech_dispatcher/speech_speech_dispatcher.c
new file mode 100644
index 000000000..87f5032f6
--- /dev/null
+++ b/navit/speech/speech_dispatcher/speech_speech_dispatcher.c
@@ -0,0 +1,67 @@
+
+/* speechd simple client program
+ * CVS revision: $Id: speech_speech_dispatcher.c,v 1.3 2007-07-08 20:41:35 martin-s Exp $
+ * Author: Tomas Cerha <cerha@brailcom.cz> */
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <glib.h>
+#include <stdarg.h>
+#include "config.h"
+#include <libspeechd.h>
+#include "plugin.h"
+#include "speech.h"
+
+struct speech_priv {
+ SPDConnection *conn;
+};
+
+static int
+speechd_say(struct speech_priv *this, const char *text) {
+ int err;
+
+ err = spd_sayf(this->conn, SPD_MESSAGE, text);
+ if (err != 1)
+ return 1;
+ return 0;
+}
+
+static void
+speechd_destroy(struct speech_priv *this) {
+ spd_close(this->conn);
+ g_free(this);
+}
+
+static struct speech_methods speechd_meth = {
+ speechd_destroy,
+ speechd_say,
+};
+
+static struct speech_priv *
+speechd_new(char *data, struct speech_methods *meth) {
+ struct speech_priv *this;
+ SPDConnection *conn;
+
+ conn = spd_open("navit","main",NULL,SPD_MODE_SINGLE);
+ if (! conn)
+ return NULL;
+ this=g_new(struct speech_priv,1);
+ if (this) {
+ this->conn=conn;
+ *meth=speechd_meth;
+ spd_set_punctuation(conn, SPD_PUNCT_NONE);
+ }
+ return this;
+}
+
+
+void
+plugin_init(void)
+{
+ plugin_register_speech_type("speech_dispatcher", speechd_new);
+}