Index: chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js |
diff --git a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js |
index c323d8020b0acb9bba5c12204c7211186977f519..5686af673d056c2a3e11edf88d5a2a740859c508 100644 |
--- a/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js |
+++ b/chrome/browser/resources/chromeos/chromevox/host/chrome/tts_background.js |
@@ -14,6 +14,7 @@ goog.require('cvox.AbstractTts'); |
goog.require('cvox.ChromeTtsBase'); |
goog.require('cvox.ChromeVox'); |
goog.require('cvox.MathMap'); |
+goog.require('cvox.PanelCommand'); |
goog.require('goog.i18n.MessageFormat'); |
@@ -301,6 +302,9 @@ cvox.TtsBackground.prototype.speakUsingQueue_ = function(utterance, queueMode) { |
// make a note that we're going to stop speech. |
if (queueMode == cvox.QueueMode.FLUSH || |
queueMode == cvox.QueueMode.CATEGORY_FLUSH) { |
+ (new cvox.PanelCommand( |
+ cvox.PanelCommandType.CLEAR_SPEECH)).send(); |
+ |
if (this.shouldCancel_(this.currentUtterance_, utterance, queueMode)) { |
this.cancelUtterance_(this.currentUtterance_); |
this.currentUtterance_ = null; |
@@ -320,6 +324,23 @@ cvox.TtsBackground.prototype.speakUsingQueue_ = function(utterance, queueMode) { |
// Next, add the new utterance to the queue. |
this.utteranceQueue_.push(utterance); |
+ console.log('Utterance: ' + utterance.textString); |
+ console.log('Properties: ' + JSON.stringify(utterance.properties)); |
+ console.log('Default properties: ' + JSON.stringify(this.ttsProperties)); |
+ |
+ // Update the caption panel. |
+ if (utterance.properties && |
+ utterance.properties['pitch'] && |
+ utterance.properties['pitch'] < this.ttsProperties['pitch']) { |
+ (new cvox.PanelCommand( |
+ cvox.PanelCommandType.ADD_ANNOTATION_SPEECH, |
+ utterance.textString)).send(); |
+ } else { |
+ (new cvox.PanelCommand( |
+ cvox.PanelCommandType.ADD_NORMAL_SPEECH, |
+ utterance.textString)).send(); |
+ } |
+ |
// Now start speaking the next item in the queue. |
this.startSpeakingNextItemInQueue_(); |
}; |
@@ -499,6 +520,8 @@ cvox.TtsBackground.prototype.stop = function() { |
this.utteranceQueue_.length = 0; |
+ (new cvox.PanelCommand( |
+ cvox.PanelCommandType.CLEAR_SPEECH)).send(); |
chrome.tts.stop(); |
}; |