| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Defines a Tts interface. | 6 * @fileoverview Defines a Tts interface. |
| 7 * | 7 * |
| 8 * All TTS engines in ChromeVox conform to the this interface. | 8 * All TTS engines in ChromeVox conform to the this interface. |
| 9 * | 9 * |
| 10 */ | 10 */ |
| 11 | 11 |
| 12 goog.provide('cvox.QueueMode'); |
| 12 goog.provide('cvox.TtsCapturingEventListener'); | 13 goog.provide('cvox.TtsCapturingEventListener'); |
| 13 goog.provide('cvox.TtsCategory'); | 14 goog.provide('cvox.TtsCategory'); |
| 14 goog.provide('cvox.TtsInterface'); | 15 goog.provide('cvox.TtsInterface'); |
| 15 | 16 |
| 16 /** | 17 /** |
| 17 * Categories for a speech utterance. This can be used with the | 18 * Categories for a speech utterance. This can be used with the |
| 18 * CATEGORY_FLUSH queue mode, which flushes all utterances from a given | 19 * CATEGORY_FLUSH queue mode, which flushes all utterances from a given |
| 19 * category but not other utterances. | 20 * category but not other utterances. |
| 20 * | 21 * |
| 21 * NAV: speech related to explicit navigation, or focus changing. | 22 * NAV: speech related to explicit navigation, or focus changing. |
| 23 * LIVE: speech coming from changes to live regions. |
| 22 * | 24 * |
| 23 * @enum {string} | 25 * @enum {string} |
| 24 */ | 26 */ |
| 25 cvox.TtsCategory = { | 27 cvox.TtsCategory = { |
| 26 LIVE: 'live', | 28 LIVE: 'live', |
| 27 NAV: 'nav' | 29 NAV: 'nav' |
| 28 }; | 30 }; |
| 29 | 31 |
| 30 /** | 32 /** |
| 33 * Queue modes for calls to {@code cvox.TtsInterface.speak}. |
| 34 * @enum |
| 35 */ |
| 36 cvox.QueueMode = { |
| 37 /** Stop speech, clear everything, then speak this utterance. */ |
| 38 FLUSH: 0, |
| 39 |
| 40 /** Append this utterance to the end of the queue. */ |
| 41 QUEUE: 1, |
| 42 |
| 43 /** |
| 44 * Clear any utterances of the same category (as set by |
| 45 * properties['category']) from the queue, then enqueue this utterance. |
| 46 */ |
| 47 CATEGORY_FLUSH: 2 |
| 48 }; |
| 49 |
| 50 /** |
| 31 * @interface | 51 * @interface |
| 32 * An interface for clients who want to get notified when an utterance | 52 * An interface for clients who want to get notified when an utterance |
| 33 * starts or ends from any source. | 53 * starts or ends from any source. |
| 34 */ | 54 */ |
| 35 cvox.TtsCapturingEventListener = function() { }; | 55 cvox.TtsCapturingEventListener = function() { }; |
| 36 | 56 |
| 37 /** | 57 /** |
| 38 * Called when any utterance starts. | 58 * Called when any utterance starts. |
| 39 */ | 59 */ |
| 40 cvox.TtsCapturingEventListener.prototype.onTtsStart = function() { }; | 60 cvox.TtsCapturingEventListener.prototype.onTtsStart = function() { }; |
| 41 | 61 |
| 42 /** | 62 /** |
| 43 * Called when any utterance ends. | 63 * Called when any utterance ends. |
| 44 */ | 64 */ |
| 45 cvox.TtsCapturingEventListener.prototype.onTtsEnd = function() { }; | 65 cvox.TtsCapturingEventListener.prototype.onTtsEnd = function() { }; |
| 46 | 66 |
| 47 | 67 |
| 48 /** | 68 /** |
| 49 * @interface | 69 * @interface |
| 50 */ | 70 */ |
| 51 cvox.TtsInterface = function() { }; | 71 cvox.TtsInterface = function() { }; |
| 52 | 72 |
| 53 /** | 73 /** |
| 54 * Speaks the given string using the specified queueMode and properties. | 74 * Speaks the given string using the specified queueMode and properties. |
| 55 * @param {string} textString The string of text to be spoken. | 75 * @param {string} textString The string of text to be spoken. |
| 56 * @param {number=} queueMode The queue mode: cvox.AbstractTts.QUEUE_MODE_FLUSH | 76 * @param {cvox.QueueMode} queueMode The queue mode to use for speaking. |
| 57 * for flush, cvox.AbstractTts.QUEUE_MODE_QUEUE for adding to queue. | |
| 58 * @param {Object=} properties Speech properties to use for this utterance. | 77 * @param {Object=} properties Speech properties to use for this utterance. |
| 59 * @return {cvox.TtsInterface} A tts object useful for chaining speak calls. | 78 * @return {cvox.TtsInterface} A tts object useful for chaining speak calls. |
| 60 */ | 79 */ |
| 61 cvox.TtsInterface.prototype.speak = | 80 cvox.TtsInterface.prototype.speak = |
| 62 function(textString, queueMode, properties) { }; | 81 function(textString, queueMode, properties) { }; |
| 63 | 82 |
| 64 | 83 |
| 65 /** | 84 /** |
| 66 * Returns true if the TTS is currently speaking. | 85 * Returns true if the TTS is currently speaking. |
| 67 * @return {boolean} True if the TTS is speaking. | 86 * @return {boolean} True if the TTS is speaking. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 89 cvox.TtsInterface.prototype.increaseOrDecreaseProperty = | 108 cvox.TtsInterface.prototype.increaseOrDecreaseProperty = |
| 90 function(propertyName, increase) { }; | 109 function(propertyName, increase) { }; |
| 91 | 110 |
| 92 | 111 |
| 93 /** | 112 /** |
| 94 * Returns the default properties of the first tts that has default properties. | 113 * Returns the default properties of the first tts that has default properties. |
| 95 * @param {string} property Name of property. | 114 * @param {string} property Name of property. |
| 96 * @return {?number} The default value. | 115 * @return {?number} The default value. |
| 97 */ | 116 */ |
| 98 cvox.TtsInterface.prototype.getDefaultProperty = function(property) { }; | 117 cvox.TtsInterface.prototype.getDefaultProperty = function(property) { }; |
| OLD | NEW |