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 TTS engine that writes to window.console.
9 goog.provide('cvox.ConsoleTts');
11 goog.require('cvox.AbstractTts');
12 goog.require('cvox.TtsInterface');
16 * @implements {cvox.TtsInterface}
18 cvox.ConsoleTts = function() {
20 * True if the console TTS is enabled by the user.
24 this.enabled_ = false;
26 goog.addSingletonGetter(cvox.ConsoleTts);
30 cvox.ConsoleTts.prototype.speak = function(textString, queueMode, properties) {
31 if (this.enabled_ && window['console']) {
33 if (queueMode == cvox.QueueMode.FLUSH) {
35 } else if (queueMode == cvox.QueueMode.CATEGORY_FLUSH) {
40 if (properties && properties.category) {
41 logStr += ' category=' + properties.category;
43 logStr += ' "' + textString + '"';
44 window['console']['log'](logStr);
46 if (properties && properties['startCallback'] != undefined) {
47 window.console.log(' using startCallback');
50 if (properties && properties['endCallback'] != undefined) {
51 window.console.log(' using endCallback');
58 cvox.ConsoleTts.prototype.isSpeaking = function() { return false; };
61 cvox.ConsoleTts.prototype.stop = function() {
63 window['console']['log']('Stop');
68 cvox.ConsoleTts.prototype.addCapturingEventListener = function(listener) { };
71 cvox.ConsoleTts.prototype.increaseOrDecreaseProperty = function() { };
74 * Sets the enabled bit.
75 * @param {boolean} enabled The new enabled bit.
77 cvox.ConsoleTts.prototype.setEnabled = function(enabled) {
78 this.enabled_ = enabled;
82 cvox.ConsoleTts.prototype.getDefaultProperty = function(property) { };