Lines Matching refs:utterance
83 // If we have a current speech utterance, then that means we're assumed to be in a speaking state.
84 // This state is independent of whether the utterance happens to be paused.
102 SpeechSynthesisUtterance* utterance = currentSpeechUtterance();
103 ASSERT(utterance);
105 utterance->setStartTime(monotonicallyIncreasingTime());
107 m_platformSpeechSynthesizer->speak(utterance->platformUtterance());
110 void SpeechSynthesis::speak(SpeechSynthesisUtterance* utterance, ExceptionState& exceptionState)
112 if (!utterance) {
113 exceptionState.throwTypeError("Invalid utterance argument");
117 m_utteranceQueue.append(utterance);
126 // Remove all the items from the utterance queue. The platform
146 void SpeechSynthesis::fireEvent(const AtomicString& type, SpeechSynthesisUtterance* utterance, unsigned long charIndex, const String& name)
149 utterance->dispatchEvent(SpeechSynthesisEvent::create(type, charIndex, (currentTime() - utterance->startTime()), name));
152 void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utterance, bool errorOccurred)
154 ASSERT(utterance);
157 // If the utterance that completed was the one we're currently speaking,
159 if (utterance == currentSpeechUtterance()) {
165 // sent an event on an utterance before it got the message that we
168 fireEvent(errorOccurred ? EventTypeNames::error : EventTypeNames::end, utterance, 0, String());
170 // Start the next utterance if we just finished one and one was pending.
175 void SpeechSynthesis::boundaryEventOccurred(PlatformSpeechSynthesisUtterance* utterance, SpeechBoundary boundary, unsigned charIndex)
182 fireEvent(EventTypeNames::boundary, static_cast<SpeechSynthesisUtterance*>(utterance->client()), charIndex, wordBoundaryString);
185 fireEvent(EventTypeNames::boundary, static_cast<SpeechSynthesisUtterance*>(utterance->client()), charIndex, sentenceBoundaryString);
192 void SpeechSynthesis::didStartSpeaking(PlatformSpeechSynthesisUtterance* utterance)
194 if (utterance->client())
195 fireEvent(EventTypeNames::start, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String());
198 void SpeechSynthesis::didPauseSpeaking(PlatformSpeechSynthesisUtterance* utterance)
201 if (utterance->client())
202 fireEvent(EventTypeNames::pause, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String());
205 void SpeechSynthesis::didResumeSpeaking(PlatformSpeechSynthesisUtterance* utterance)
208 if (utterance->client())
209 fireEvent(EventTypeNames::resume, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String());
212 void SpeechSynthesis::didFinishSpeaking(PlatformSpeechSynthesisUtterance* utterance)
214 if (utterance->client())
215 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), false);
218 void SpeechSynthesis::speakingErrorOccurred(PlatformSpeechSynthesisUtterance* utterance)
220 if (utterance->client())
221 handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), true);