Index: chrome/browser/resources/access_chromevox/audio/background/emacspeak_tts_server_engine.js |
=================================================================== |
--- chrome/browser/resources/access_chromevox/audio/background/emacspeak_tts_server_engine.js (revision 0) |
+++ chrome/browser/resources/access_chromevox/audio/background/emacspeak_tts_server_engine.js (revision 0) |
@@ -0,0 +1,72 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+/** |
+ * @fileoverview Text-To-Speech engine that is using the Emacspeak |
+ * local speech server. |
+ */ |
+ |
+goog.provide('cvox.ChromeVoxEmacspeakTtsServerEngine'); |
+ |
+goog.require('cvox.AbstractTts'); |
+ |
+/** |
+ * @constructor |
+ * @extends {cvox.AbstractTts} |
+ */ |
+cvox.ChromeVoxEmacspeakTtsServerEngine = function() { |
+ //Inherit AbstractTts |
+ cvox.AbstractTts.call(this); |
+}; |
+goog.inherits(cvox.ChromeVoxEmacspeakTtsServerEngine, cvox.AbstractTts); |
+ |
+/** |
+ * @return {string} The human-readable name of the speech engine. |
+ */ |
+cvox.ChromeVoxEmacspeakTtsServerEngine.prototype.getName = function() { |
+ return 'Local Speech'; |
+}; |
+ |
+/** |
+ * Speaks the given string using the specified queueMode and properties. |
+ * @param {string} textString The string of text to be spoken. |
+ * @param {number=} queueMode The queue mode: AbstractTts.QUEUE_MODE_FLUSH |
+ * for flush, AbstractTts.QUEUE_MODE_QUEUE for adding to queue. |
+ * @param {Object=} properties Speech properties to use for this utterance. |
+ */ |
+cvox.ChromeVoxEmacspeakTtsServerEngine.prototype.speak = function( |
+ textString, queueMode, properties) { |
+ cvox.ChromeVoxEmacspeakTtsServerEngine.superClass_.speak.call(this, |
+ textString, queueMode, properties); |
+ if (queueMode == cvox.AbstractTts.QUEUE_MODE_FLUSH) { |
+ this.stop(); |
+ } |
+ var emacspeakConnection = new XMLHttpRequest(); |
+ emacspeakConnection.overrideMimeType('text/xml'); |
+ emacspeakConnection.open('POST', 'http://127.0.0.1:8000', true); |
+ emacspeakConnection.setRequestHeader('Content-Type', |
+ 'application/x-www-form-urlencoded'); |
+ emacspeakConnection.send('speak: ' + textString); |
+}; |
+ |
+/** |
+ * @return {boolean} True if the TTS is speaking. |
+ */ |
+cvox.ChromeVoxEmacspeakTtsServerEngine.prototype.isSpeaking = function() { |
+ cvox.ChromeVoxEmacspeakTtsServerEngine.superClass_.isSpeaking.call(this); |
+ return false; |
+}; |
+ |
+/** |
+ * Stops speech. |
+ */ |
+cvox.ChromeVoxEmacspeakTtsServerEngine.prototype.stop = function() { |
+ cvox.ChromeVoxEmacspeakTtsServerEngine.superClass_.stop.call(this); |
+ var emacspeakConnection = new XMLHttpRequest(); |
+ emacspeakConnection.overrideMimeType('text/xml'); |
+ emacspeakConnection.open('POST', 'http://127.0.0.1:8000', true); |
+ emacspeakConnection.setRequestHeader('Content-Type', |
+ 'application/x-www-form-urlencoded'); |
+ emacspeakConnection.send('stop'); |
+}; |
Property changes on: chrome/browser/resources/access_chromevox/audio/background/emacspeak_tts_server_engine.js |
___________________________________________________________________ |
Added: svn:executable |
+ * |
Added: svn:eol-style |
+ LF |