OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 /** |
| 6 * @fileoverview Text-To-Speech engine that is running as a local server. |
| 7 */ |
| 8 |
| 9 goog.provide('cvox.ChromeVoxLocalTtsServerEngine'); |
| 10 |
| 11 goog.require('cvox.AbstractTts'); |
| 12 |
| 13 /** |
| 14 * @constructor |
| 15 * @extends {cvox.AbstractTts} |
| 16 */ |
| 17 cvox.ChromeVoxLocalTtsServerEngine = function() { |
| 18 //Inherit AbstractTts |
| 19 cvox.AbstractTts.call(this); |
| 20 }; |
| 21 goog.inherits(cvox.ChromeVoxLocalTtsServerEngine, cvox.AbstractTts); |
| 22 |
| 23 /** |
| 24 * @return {string} The human-readable name of the speech engine. |
| 25 */ |
| 26 cvox.ChromeVoxLocalTtsServerEngine.prototype.getName = function() { |
| 27 return 'Local Speech'; |
| 28 }; |
| 29 |
| 30 /** |
| 31 * Speaks the given string using the specified queueMode and properties. |
| 32 * @param {string} textString The string of text to be spoken. |
| 33 * @param {number=} queueMode The queue mode: AbstractTts.QUEUE_MODE_FLUSH |
| 34 * for flush, AbstractTts.QUEUE_MODE_QUEUE for adding to queue. |
| 35 * @param {Object=} properties Speech properties to use for this utterance. |
| 36 */ |
| 37 cvox.ChromeVoxLocalTtsServerEngine.prototype.speak = function( |
| 38 textString, queueMode, properties) { |
| 39 cvox.ChromeVoxLocalTtsServerEngine.superClass_.speak.call(this, |
| 40 textString, queueMode, properties); |
| 41 //This is VERY hacky, but it works as a demo |
| 42 var theScript = document.createElement('script'); |
| 43 theScript.type = 'text/javascript'; |
| 44 theScript.src = 'http://localhost/' + textString; |
| 45 document.getElementsByTagName('head')[0].appendChild(theScript); |
| 46 }; |
| 47 |
| 48 /** |
| 49 * @return {boolean} True if the TTS is speaking. |
| 50 */ |
| 51 cvox.ChromeVoxLocalTtsServerEngine.prototype.isSpeaking = function() { |
| 52 cvox.ChromeVoxLocalTtsServerEngine.superClass_.isSpeaking.call(this); |
| 53 return false; |
| 54 }; |
| 55 |
| 56 /** |
| 57 * Stops speech. |
| 58 */ |
| 59 cvox.ChromeVoxLocalTtsServerEngine.prototype.stop = function() { |
| 60 cvox.ChromeVoxLocalTtsServerEngine.superClass_.stop.call(this); |
| 61 this.speak(''); |
| 62 }; |
OLD | NEW |