Lines Matching defs:this

2 // Use of this source code is governed by a BSD-style license that can be
12 * request and the parameters match one of the voices in this extension's
18 * The main class for this extension. Adds listeners to
39 * until the speech synthesis server capabilities response provides this.
40 * The key of this map is of the form '<lang>-<gender>'.
77 * This is the main function called to initialize this extension.
84 this.voiceNameToLangAndGender_[voices[i].voice_name] = {
91 this.audioElement_ = document.createElement('audio');
92 document.body.appendChild(this.audioElement_);
93 this.audioElement_.addEventListener(
94 'ended', this.onStop_.bind(this), false);
95 this.audioElement_.addEventListener(
96 'canplaythrough', this.onStart_.bind(this), false);
99 chrome.ttsEngine.onSpeak.addListener(this.onSpeak_.bind(this));
100 chrome.ttsEngine.onStop.addListener(this.onStop_.bind(this));
101 chrome.ttsEngine.onPause.addListener(this.onPause_.bind(this));
102 chrome.ttsEngine.onResume.addListener(this.onResume_.bind(this));
124 this.onStop_();
126 this.currentUtterance_ = {
135 lang = this.voiceNameToLangAndGender_[options.voiceName].lang;
136 gender = this.voiceNameToLangAndGender_[options.voiceName].gender;
142 // Look up the specific voice name for this language and gender.
147 var voiceName = this.LANG_AND_GENDER_TO_VOICE_NAME_[key];
149 var url = this.SPEECH_SERVER_URL_;
172 // the 'canplaythrough' handler will call this.onStart_,
175 this.audioElement_.src = url;
176 }).bind(this));
183 this.currentUtterance_ = null;
199 if (this.currentUtterance_) {
200 this.audioElement_.pause();
201 this.currentUtterance_.callback({
203 'charIndex': this.currentUtterance_.utterance.length
206 this.currentUtterance_ = null;
217 if (this.currentUtterance_) {
218 if (this.currentUtterance_.options.volume !== undefined) {
220 this.audioElement_.volume = this.currentUtterance_.options.volume;
222 this.audioElement_.play();
223 this.currentUtterance_.callback({
236 if (this.currentUtterance_) {
237 this.audioElement_.pause();
247 if (this.currentUtterance_) {
248 this.audioElement_.play();