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 A composite TTS sends allows ChromeVox to use
7 * multiple TTS engines at the same time.
11 goog.provide('cvox.CompositeTts');
13 goog.require('cvox.TtsInterface');
18 * @implements {cvox.TtsInterface}
20 cvox.CompositeTts = function() {
22 * @type {Array<cvox.TtsInterface>}
25 this.ttsEngines_ = [];
30 * Adds a TTS engine to the composite TTS
31 * @param {cvox.TtsInterface} tts The TTS to add.
32 * @return {cvox.CompositeTts} this.
34 cvox.CompositeTts.prototype.add = function(tts) {
35 this.ttsEngines_.push(tts);
43 cvox.CompositeTts.prototype.speak =
44 function(textString, queueMode, properties) {
45 this.ttsEngines_.forEach(function(engine) {
46 engine.speak(textString, queueMode, properties);
52 * Returns true if any of the TTSes are still speaking.
55 cvox.CompositeTts.prototype.isSpeaking = function() {
56 return this.ttsEngines_.some(function(engine) {
57 return engine.isSpeaking();
65 cvox.CompositeTts.prototype.stop = function() {
66 this.ttsEngines_.forEach(function(engine) {
75 cvox.CompositeTts.prototype.addCapturingEventListener = function(listener) {
76 this.ttsEngines_.forEach(function(engine) {
77 engine.addCapturingEventListener(listener);
85 cvox.CompositeTts.prototype.increaseOrDecreaseProperty =
86 function(propertyName, increase) {
87 this.ttsEngines_.forEach(function(engine) {
88 engine.increaseOrDecreaseProperty(propertyName, increase);
96 cvox.CompositeTts.prototype.getDefaultProperty = function(property) {
97 for (var i = 0, engine; engine = this.ttsEngines_[i]; i++) {
98 var value = engine.getDefaultProperty(property);