| Index: chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js
|
| ===================================================================
|
| --- chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js (revision 0)
|
| +++ chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js (revision 0)
|
| @@ -0,0 +1,77 @@
|
| +// 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 Sends Text-To-Speech commands to the TTS that is
|
| + * embedded in ChromeOS.
|
| + */
|
| +
|
| +goog.provide('cvox.ChromeVoxChromeOsTtsEngine');
|
| +
|
| +goog.require('cvox.AbstractTts');
|
| +
|
| +/**
|
| + * @constructor
|
| + * @extends {cvox.AbstractTts}
|
| + */
|
| +cvox.ChromeVoxChromeOsTtsEngine = function() {
|
| + //Inherit AbstractTts
|
| + cvox.AbstractTts.call(this);
|
| +};
|
| +goog.inherits(cvox.ChromeVoxChromeOsTtsEngine, cvox.AbstractTts);
|
| +
|
| +/**
|
| + * @return {string} The human-readable name of the speech engine.
|
| + */
|
| +cvox.ChromeVoxChromeOsTtsEngine.prototype.getName = function() {
|
| + return 'Chrome OS Native 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.ChromeVoxChromeOsTtsEngine.prototype.speak = function(
|
| + textString, queueMode, properties) {
|
| + cvox.ChromeVoxChromeOsTtsEngine.superClass_.speak.call(this, textString,
|
| + queueMode, properties);
|
| + if (queueMode === cvox.AbstractTts.QUEUE_MODE_FLUSH) {
|
| + this.stop();
|
| + }
|
| + var mergedProperties = this.mergeProperties(properties);
|
| + mergedProperties.enqueue = (queueMode === cvox.AbstractTts.QUEUE_MODE_QUEUE);
|
| + // chrome.experimental.tts.speak is a call directly into Chrome, so
|
| + // chrome.experimental.tts.speak(textString, null); is NOT the same as
|
| + // chrome.experimental.tts.speak(textString);
|
| + //
|
| + // TODO (chaitanyag): Make the underlying code handle var args so that
|
| + // properties can be optional and match JS expected behavior of these two
|
| + // being the same.
|
| + if (mergedProperties) {
|
| + chrome.experimental.tts.speak(textString, mergedProperties);
|
| + } else {
|
| + chrome.experimental.tts.speak(textString);
|
| + }
|
| +};
|
| +
|
| +/**
|
| + * Returns true if the TTS is currently speaking.
|
| + * @return {boolean} True if the TTS is speaking.
|
| + */
|
| +cvox.ChromeVoxChromeOsTtsEngine.prototype.isSpeaking = function() {
|
| + cvox.ChromeVoxChromeOsTtsEngine.superClass_.isSpeaking.call(this);
|
| + return chrome.experimental.tts.isSpeaking();
|
| +};
|
| +
|
| +/**
|
| + * Stops speech.
|
| + */
|
| +cvox.ChromeVoxChromeOsTtsEngine.prototype.stop = function() {
|
| + cvox.ChromeVoxChromeOsTtsEngine.superClass_.stop.call(this);
|
| + chrome.experimental.tts.stop();
|
| +};
|
| +
|
|
|
| Property changes on: chrome/browser/resources/access_chromevox/audio/background/chrome_native_tts_engine.js
|
| ___________________________________________________________________
|
| Added: svn:executable
|
| + *
|
| Added: svn:eol-style
|
| + LF
|
|
|
|
|