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
3 // found in the LICENSE file.
6 * @fileoverview Defines a Tts interface.
8 * All TTS engines in ChromeVox conform to the this interface.
12 goog.provide('cvox.QueueMode');
13 goog.provide('cvox.TtsCapturingEventListener');
14 goog.provide('cvox.TtsCategory');
15 goog.provide('cvox.TtsInterface');
18 * Categories for a speech utterance. This can be used with the
19 * CATEGORY_FLUSH queue mode, which flushes all utterances from a given
20 * category but not other utterances.
22 * NAV: speech related to explicit navigation, or focus changing.
23 * LIVE: speech coming from changes to live regions.
33 * Queue modes for calls to {@code cvox.TtsInterface.speak}.
37 /** Stop speech, clear everything, then speak this utterance. */
40 /** Append this utterance to the end of the queue. */
44 * Clear any utterances of the same category (as set by
45 * properties['category']) from the queue, then enqueue this utterance.
52 * An interface for clients who want to get notified when an utterance
53 * starts or ends from any source.
55 cvox.TtsCapturingEventListener = function() { };
58 * Called when any utterance starts.
60 cvox.TtsCapturingEventListener.prototype.onTtsStart = function() { };
63 * Called when any utterance ends.
65 cvox.TtsCapturingEventListener.prototype.onTtsEnd = function() { };
71 cvox.TtsInterface = function() { };
74 * Speaks the given string using the specified queueMode and properties.
75 * @param {string} textString The string of text to be spoken.
76 * @param {cvox.QueueMode} queueMode The queue mode to use for speaking.
77 * @param {Object=} properties Speech properties to use for this utterance.
78 * @return {cvox.TtsInterface} A tts object useful for chaining speak calls.
80 cvox.TtsInterface.prototype.speak =
81 function(textString, queueMode, properties) { };
85 * Returns true if the TTS is currently speaking.
86 * @return {boolean} True if the TTS is speaking.
88 cvox.TtsInterface.prototype.isSpeaking = function() { };
94 cvox.TtsInterface.prototype.stop = function() { };
97 * Adds a listener to get called whenever any utterance starts or ends.
98 * @param {cvox.TtsCapturingEventListener} listener Listener to get called.
100 cvox.TtsInterface.prototype.addCapturingEventListener = function(listener) { };
103 * Increases a TTS speech property.
104 * @param {string} propertyName The name of the property to change.
105 * @param {boolean} increase If true, increases the property value by one
106 * step size, otherwise decreases.
108 cvox.TtsInterface.prototype.increaseOrDecreaseProperty =
109 function(propertyName, increase) { };
113 * Returns the default properties of the first tts that has default properties.
114 * @param {string} property Name of property.
115 * @return {?number} The default value.
117 cvox.TtsInterface.prototype.getDefaultProperty = function(property) { };