[asterisk-commits] seanbright: branch seanbright/tts r426116 - in /team/seanbright/tts: apps/ in...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 22 17:27:57 CDT 2014


Author: seanbright
Date: Wed Oct 22 17:27:53 2014
New Revision: 426116

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=426116
Log:
And then an app appeared that does nothing.

Modified:
    team/seanbright/tts/apps/app_speech_utils.c
    team/seanbright/tts/include/asterisk/tts.h
    team/seanbright/tts/res/res_tts.c

Modified: team/seanbright/tts/apps/app_speech_utils.c
URL: http://svnview.digium.com/svn/asterisk/team/seanbright/tts/apps/app_speech_utils.c?view=diff&rev=426116&r1=426115&r2=426116
==============================================================================
--- team/seanbright/tts/apps/app_speech_utils.c (original)
+++ team/seanbright/tts/apps/app_speech_utils.c Wed Oct 22 17:27:53 2014
@@ -109,7 +109,6 @@
 			and ${SPEECH_SCORE(1)}.</para>
 			<para>The first argument is the sound file and the second is the timeout integer in seconds.</para>
 			<para>Hangs up the channel on failure. If this is not desired, use TryExec.</para>
-			
 		</description>
 	</application>
 	<application name="SpeechDeactivateGrammar" language="en_US">
@@ -174,6 +173,18 @@
 		<description>
 			<para>Unload a grammar.</para>
 			<para>Hangs up the channel on failure. If this is not desired, use TryExec.</para>
+		</description>
+	</application>
+	<application name="SpeechSay" language="en_US">
+		<synopsis>
+			Say something.
+		</synopsis>
+		<syntax>
+			<parameter name="engine" required="false" />
+			<parameter name="text" required="true" />
+		</syntax>
+		<description>
+			<para>Takes some text, turns it into speech.</para>
 		</description>
 	</application>
 	<function name="SPEECH_SCORE" language="en_US">
@@ -955,10 +966,16 @@
 	return speech_datastore_destroy(chan);
 }
 
+static int speech_say(struct ast_channel *chan, const char *data)
+{
+	return 0;
+}
+
 static int unload_module(void)
 {
 	int res = 0;
 
+	/* Speech Recognition */
 	res = ast_unregister_application("SpeechCreate");
 	res |= ast_unregister_application("SpeechLoadGrammar");
 	res |= ast_unregister_application("SpeechUnloadGrammar");
@@ -975,13 +992,17 @@
 	res |= ast_custom_function_unregister(&speech_engine_function);
 	res |= ast_custom_function_unregister(&speech_results_type_function);
 
-	return res;	
+	/* Text-To-Speech */
+	res |= ast_unregister_application("SpeechSay");
+
+	return res;
 }
 
 static int load_module(void)
 {
 	int res = 0;
 
+	/* Speech Recognition */
 	res = ast_register_application_xml("SpeechCreate", speech_create);
 	res |= ast_register_application_xml("SpeechLoadGrammar", speech_load);
 	res |= ast_register_application_xml("SpeechUnloadGrammar", speech_unload);
@@ -998,6 +1019,9 @@
 	res |= ast_custom_function_register(&speech_engine_function);
 	res |= ast_custom_function_register(&speech_results_type_function);
 
+	/* Text-To-Speech */
+	res |= ast_register_application_xml("SpeechSay", speech_say);
+
 	return res;
 }
 

Modified: team/seanbright/tts/include/asterisk/tts.h
URL: http://svnview.digium.com/svn/asterisk/team/seanbright/tts/include/asterisk/tts.h?view=diff&rev=426116&r1=426115&r2=426116
==============================================================================
--- team/seanbright/tts/include/asterisk/tts.h (original)
+++ team/seanbright/tts/include/asterisk/tts.h Wed Oct 22 17:27:53 2014
@@ -30,6 +30,12 @@
 struct ast_tts_engine {
 	/*! Name of TTS engine */
 	char *name;
+	/*! Render the specified text to the specified channel */
+	int (*speak)(const struct ast_channel *channel, const char *text);
+	/*! Change an engine specific setting */
+	int (*setting_write)(const char *name, const char *value);
+	/*! Get an engine specific setting */
+        int (*setting_read)(const char *name, char *buf, size_t len);
 	AST_LIST_ENTRY(ast_tts_engine) list;
 };
 

Modified: team/seanbright/tts/res/res_tts.c
URL: http://svnview.digium.com/svn/asterisk/team/seanbright/tts/res/res_tts.c?view=diff&rev=426116&r1=426115&r2=426116
==============================================================================
--- team/seanbright/tts/res/res_tts.c (original)
+++ team/seanbright/tts/res/res_tts.c Wed Oct 22 17:27:53 2014
@@ -69,6 +69,11 @@
 {
 	int res = 0;
 
+	if (!engine->speak) {
+		ast_log(LOG_WARNING, "TTS engine '%s' did not meet minimum API requirements.\n", engine->name);
+		return -1;
+	}
+
 	/* If an engine is already loaded with this name, error out */
 	if (find_engine(engine->name)) {
 		ast_log(LOG_WARNING, "TTS engine '%s' already exists.\n", engine->name);




More information about the asterisk-commits mailing list