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. 4 5 /** 6 * @fileoverview Defines a Tts interface. 7 * 8 * All TTS engines in ChromeVox conform to the this interface. 9 * 10 */ 11 12 goog.provide('cvox.TtsInterface'); 13 goog.provide('cvox.TtsCapturingEventListener'); 14 15 /** 16 * @interface 17 * An interface for clients who want to get notified when an utterance 18 * starts or ends from any source. 19 */ 20 cvox.TtsCapturingEventListener = function() { }; 21 22 /** 23 * Called when any utterance starts. 24 */ 25 cvox.TtsCapturingEventListener.prototype.onTtsStart = function() { }; 26 27 /** 28 * Called when any utterance ends. 29 */ 30 cvox.TtsCapturingEventListener.prototype.onTtsEnd = function() { }; 31 32 33 /** 34 * @interface 35 */ 36 cvox.TtsInterface = function() { }; 37 38 /** 39 * Speaks the given string using the specified queueMode and properties. 40 * @param {string} textString The string of text to be spoken. 41 * @param {number=} queueMode The queue mode: cvox.AbstractTts.QUEUE_MODE_FLUSH 42 * for flush, cvox.AbstractTts.QUEUE_MODE_QUEUE for adding to queue. 43 * @param {Object=} properties Speech properties to use for this utterance. 44 * @return {cvox.TtsInterface} A tts object useful for chaining speak calls. 45 */ 46 cvox.TtsInterface.prototype.speak = 47 function(textString, queueMode, properties) { }; 48 49 50 /** 51 * Returns true if the TTS is currently speaking. 52 * @return {boolean} True if the TTS is speaking. 53 */ 54 cvox.TtsInterface.prototype.isSpeaking = function() { }; 55 56 57 /** 58 * Stops speech. 59 */ 60 cvox.TtsInterface.prototype.stop = function() { }; 61 62 /** 63 * Adds a listener to get called whenever any utterance starts or ends. 64 * @param {cvox.TtsCapturingEventListener} listener Listener to get called. 65 */ 66 cvox.TtsInterface.prototype.addCapturingEventListener = function(listener) { }; 67 68 /** 69 * Increases a TTS speech property. 70 * @param {string} propertyName The name of the property to change. 71 * @param {boolean} increase If true, increases the property value by one 72 * step size, otherwise decreases. 73 */ 74 cvox.TtsInterface.prototype.increaseOrDecreaseProperty = 75 function(propertyName, increase) { }; 76 77 78 /** 79 * Returns the default properties of the first tts that has default properties. 80 * @param {string} property Name of property. 81 * @return {?number} The default value. 82 */ 83 cvox.TtsInterface.prototype.getDefaultProperty = function(property) { }; 84