speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] merge SPDNotification into SPDNotificationType


From: Andrei Kholodnyi
Subject: [PATCH] merge SPDNotification into SPDNotificationType
Date: Sun, 26 Sep 2010 01:05:00 +0200

SPDNotification and SPDNotificationType were similar enums.
SPDNotification was removed
enum values in SPDNotificationType were modified to values
from SPDNotification to allow a setting of notification mask
SPD_EVENT_ALL was introduced to support "all" notification mask of SSIP
---
 src/api/c/libspeechd.c |   21 +++++++++++----------
 src/api/c/libspeechd.h |   31 ++++++++++++-------------------
 src/clients/say/say.c  |    4 ++--
 3 files changed, 25 insertions(+), 31 deletions(-)

diff --git a/src/api/c/libspeechd.c b/src/api/c/libspeechd.c
index 53247ba..2b2ff91 100644
--- a/src/api/c/libspeechd.c
+++ b/src/api/c/libspeechd.c
@@ -1014,7 +1014,7 @@ SPD_SET_COMMAND_SPECIAL(voice_type, SPDVoiceType)
 #undef SPD_SET_COMMAND_SPECIAL
 
 int
-spd_set_notification_on(SPDConnection *connection, SPDNotification 
notification)
+spd_set_notification_on(SPDConnection *connection, SPDNotificationType 
notification)
 {
     if (connection->mode == SPD_MODE_THREADED)
        return spd_set_notification(connection, notification, "on");
@@ -1023,7 +1023,7 @@ spd_set_notification_on(SPDConnection *connection, 
SPDNotification notification)
 }
 
 int
-spd_set_notification_off(SPDConnection *connection, SPDNotification 
notification)
+spd_set_notification_off(SPDConnection *connection, SPDNotificationType 
notification)
 {
     if (connection->mode == SPD_MODE_THREADED)
        return spd_set_notification(connection, notification, "off");
@@ -1040,7 +1040,7 @@ spd_set_notification_off(SPDConnection *connection, 
SPDNotification notification
     }
 
 int
-spd_set_notification(SPDConnection *connection, SPDNotification notification, 
const char* state)
+spd_set_notification(SPDConnection *connection, SPDNotificationType 
notification, const char* state)
 {
     static char command[64];
     int ret;
@@ -1058,12 +1058,13 @@ spd_set_notification(SPDConnection *connection, 
SPDNotification notification, co
 
     pthread_mutex_lock(connection->ssip_mutex);
 
-    NOTIFICATION_SET(SPD_INDEX_MARKS, "index_marks");
-    NOTIFICATION_SET(SPD_BEGIN, "begin");
-    NOTIFICATION_SET(SPD_END, "end");
-    NOTIFICATION_SET(SPD_CANCEL, "cancel");
-    NOTIFICATION_SET(SPD_PAUSE, "pause");
-    NOTIFICATION_SET(SPD_RESUME, "resume");
+    NOTIFICATION_SET(SPD_EVENT_BEGIN, "begin");
+    NOTIFICATION_SET(SPD_EVENT_END, "end");
+    NOTIFICATION_SET(SPD_EVENT_CANCEL, "cancel");
+    NOTIFICATION_SET(SPD_EVENT_PAUSE, "pause");
+    NOTIFICATION_SET(SPD_EVENT_RESUME, "resume");
+    NOTIFICATION_SET(SPD_EVENT_INDEX_MARKS, "index_marks");
+    NOTIFICATION_SET(SPD_EVENT_ALL, "all");
 
     pthread_mutex_unlock(connection->ssip_mutex);
 
@@ -1467,7 +1468,7 @@ spd_events_handler(void* conn)
                  break;
                }
                /* Call the callback */
-               connection->callback_im(msg_id, client_id, 
SPD_EVENT_INDEX_MARK, im);
+               connection->callback_im(msg_id, client_id, 
SPD_EVENT_INDEX_MARKS, im);
                xfree(im);
            }
 
diff --git a/src/api/c/libspeechd.h b/src/api/c/libspeechd.h
index 62a8348..b841b47 100644
--- a/src/api/c/libspeechd.h
+++ b/src/api/c/libspeechd.h
@@ -83,13 +83,15 @@ typedef struct{
 }SPDVoice;
 
 typedef enum{
-    SPD_BEGIN = 1,
-    SPD_END = 2,
-    SPD_INDEX_MARKS = 4,
-    SPD_CANCEL = 8,
-    SPD_PAUSE = 16,
-    SPD_RESUME = 32
-}SPDNotification;
+    SPD_EVENT_BEGIN = 1,
+    SPD_EVENT_END = 2,
+    SPD_EVENT_INDEX_MARKS = 4,
+    SPD_EVENT_CANCEL = 8,
+    SPD_EVENT_PAUSE = 16,
+    SPD_EVENT_RESUME = 32,
+
+    SPD_EVENT_ALL = 0x3F
+}SPDNotificationType;
 
 typedef enum{
     SPD_IMPORTANT = 1,
@@ -100,15 +102,6 @@ typedef enum{
 }SPDPriority;
 
 typedef enum{
-    SPD_EVENT_BEGIN,
-    SPD_EVENT_END,
-    SPD_EVENT_CANCEL,
-    SPD_EVENT_PAUSE,
-    SPD_EVENT_RESUME,
-    SPD_EVENT_INDEX_MARK
-}SPDNotificationType;
-
-typedef enum{
     SPD_MODE_SINGLE = 0,
     SPD_MODE_THREADED = 1
 }SPDConnectionMode;
@@ -209,9 +202,9 @@ int spd_set_synthesis_voice_uid(SPDConnection*, const char 
*voice_name, unsigned
 
 int spd_set_data_mode(SPDConnection *connection, SPDDataMode mode);
 
-int spd_set_notification_on(SPDConnection* connection, SPDNotification 
notification);
-int spd_set_notification_off(SPDConnection* connection, SPDNotification 
notification);
-int spd_set_notification(SPDConnection* connection, SPDNotification 
notification, const char* state);
+int spd_set_notification_on(SPDConnection* connection, SPDNotificationType 
notification);
+int spd_set_notification_off(SPDConnection* connection, SPDNotificationType 
notification);
+int spd_set_notification(SPDConnection* connection, SPDNotificationType 
notification, const char* state);
 
 int spd_set_voice_rate(SPDConnection* connection, signed int rate);
 int spd_set_voice_rate_all(SPDConnection* connection, signed int rate);
diff --git a/src/clients/say/say.c b/src/clients/say/say.c
index 64b4bd8..ceda4e1 100644
--- a/src/clients/say/say.c
+++ b/src/clients/say/say.c
@@ -206,8 +206,8 @@ int main(int argc, char **argv) {
         /* Notify when the message is canceled or the speech terminates */
         conn->callback_end = end_of_speech;
         conn->callback_cancel = end_of_speech;
-        spd_set_notification_on(conn, SPD_END);
-        spd_set_notification_on(conn, SPD_CANCEL);
+        spd_set_notification_on(conn, SPD_EVENT_END);
+        spd_set_notification_on(conn, SPD_EVENT_CANCEL);
     }
 
     /* In pipe mode, read from stdin, write to stdout, and also to Speech 
Dispatcher. */
-- 
1.6.0.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]