| Index: chrome/browser/resources/access_chromevox/audio/background/gooss_engine.js
|
| ===================================================================
|
| --- chrome/browser/resources/access_chromevox/audio/background/gooss_engine.js (revision 0)
|
| +++ chrome/browser/resources/access_chromevox/audio/background/gooss_engine.js (revision 0)
|
| @@ -0,0 +1,74 @@
|
| +// 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 powered by GooSS. This engine relies on
|
| + * HTML5.
|
| + *
|
| + * Note: There are currently still a few problems with long utterances and the
|
| + * way GooSS generates MP3s.
|
| + */
|
| +
|
| +goog.provide('cvox.ChromeVoxGoossEngine');
|
| +
|
| +goog.require('cvox.AbstractTts');
|
| +
|
| +/**
|
| + * @constructor
|
| + * @extends {cvox.AbstractTts}
|
| + */
|
| +cvox.ChromeVoxGoossEngine = function() {
|
| + //Inherit AbstractTts
|
| + cvox.AbstractTts.call(this);
|
| +
|
| + this.speechServerUrl = 'http://www.google.com/speech-api/' +
|
| + 'v1/synthesize?lang=en-us&text=';
|
| + this.audioElem = document.createElement('audio');
|
| +};
|
| +goog.inherits(cvox.ChromeVoxGoossEngine, cvox.AbstractTts);
|
| +
|
| +/**
|
| + * @return {string} The human-readable name of the speech engine.
|
| + */
|
| +cvox.ChromeVoxGoossEngine.prototype.getName = function() {
|
| + return 'Google Network 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.ChromeVoxGoossEngine.prototype.speak = function(textString, queueMode,
|
| + properties) {
|
| + cvox.ChromeVoxGoossEngine.superClass_.speak.call(this, textString,
|
| + queueMode, properties);
|
| + // TODO: Implement speech queue so that queued speech is possible
|
| + this.audioElem.pause();
|
| + this.audioElem.src = this.speechServerUrl + escape(textString);
|
| + this.audioElem.autoplay = true;
|
| + this.isSpeaking_ = true;
|
| + this.audioElem.addEventListener('ended', function(evt) {
|
| + this.isSpeaking_ = false;
|
| + }, true);
|
| +};
|
| +
|
| +/**
|
| + * Returns true if the TTS is currently speaking.
|
| + * @return {boolean} True if the TTS is speaking.
|
| + */
|
| +cvox.ChromeVoxGoossEngine.prototype.isSpeaking = function() {
|
| + cvox.ChromeVoxGoossEngine.superClass_.isSpeaking.call(this);
|
| + return this.isSpeaking_;
|
| +};
|
| +
|
| +/**
|
| + * Stops speech.
|
| + */
|
| +cvox.ChromeVoxGoossEngine.prototype.stop = function() {
|
| + cvox.ChromeVoxGoossEngine.superClass_.stop.call(this);
|
| + this.audioElem.pause();
|
| +};
|
|
|
| Property changes on: chrome/browser/resources/access_chromevox/audio/background/gooss_engine.js
|
| ___________________________________________________________________
|
| Added: svn:executable
|
| + *
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|