class Speaker
Defined at line 35 of file ../../src/ui/a11y/lib/screen_reader/speaker.h
A Speaker manages speech tasks to be executed by the Screen Reader.
Speech tasks are represented in the form of fpromise::promises. A task manages the dispatch of
utterances, in the right order and at the right time, that together make a node description.
Please see ScreenReaderMessageGenerator for more details. Speech tasks must run at the same
executor. A task can wait on another task to finish before it starts or start right away,
depending on the option selected. Please see Options for details. A task is not added to the
queue of tasks until it runs. This allows creating multiple speech tasks in any order, but
controlling the order they will run at dispatch time, not at building time. Important! The
description of a node is built at task creation time, not during run time. this simplifies the
management of semantic nodes and their life time. This guarantees that no reference to a semantic
node is kept inside of the task, creating the problem of keeping a node alive until the task
finishes running.
Public Methods
void Speaker (async::Executor * executor, fuchsia::accessibility::tts::EnginePtr * tts_engine_ptr, std::unique_ptr<ScreenReaderMessageGenerator> screen_reader_message_generator)
Defined at line 38 of file ../../src/ui/a11y/lib/screen_reader/speaker.cc
void ~Speaker ()
Defined at line 46 of file ../../src/ui/a11y/lib/screen_reader/speaker.cc
fpromise::promise<> SpeakNodePromise (const fuchsia::accessibility::semantics::Node * node, Options options, ScreenReaderMessageGenerator::ScreenReaderMessageContext message_context)
Returns a speech task that speaks the node description.
Defined at line 60 of file ../../src/ui/a11y/lib/screen_reader/speaker.cc
fpromise::promise<> SpeakMessagePromise (fuchsia::accessibility::tts::Utterance utterance, Options options)
Returns a speech task that speaks the provided |message|.
Defined at line 70 of file ../../src/ui/a11y/lib/screen_reader/speaker.cc
const std::string & last_utterance ()
Returns a string with the last spoken utterance.
Defined at line 75 of file ../../src/ui/a11y/lib/screen_reader/speaker.h
void set_epitaph (fuchsia::intl::l10n::MessageIds epitaph)
Sets a message to be spoken just before this object is destroyed.
Defined at line 78 of file ../../src/ui/a11y/lib/screen_reader/speaker.h
fpromise::promise<> SpeakMessageByIdPromise (fuchsia::intl::l10n::MessageIds message_id, Options options)
Returns a speech task that speaks the canonical message specified by
|message_id|.
Defined at line 80 of file ../../src/ui/a11y/lib/screen_reader/speaker.cc
ScreenReaderMessageGenerator * message_generator_for_test ()
For tests only
Defined at line 81 of file ../../src/ui/a11y/lib/screen_reader/speaker.h
fpromise::promise<> SpeakNodeCanonicalizedLabelPromise (const fuchsia::accessibility::semantics::Node * node, Options options)
Returns a speech task that speaks the node's canonicalized label.
(Preprocesses symbols and capital letters to ensure the correct pronunciation of virtual
keyboard keys instead of leaving it up to the TTS service.)
Defined at line 91 of file ../../src/ui/a11y/lib/screen_reader/speaker.cc
fpromise::promise<> CancelTts ()
Returns a promise that cancels pending or in progress tts utterances.
Defined at line 186 of file ../../src/ui/a11y/lib/screen_reader/speaker.cc
Protected Methods
void Speaker ()
For mocks.
Defined at line 87 of file ../../src/ui/a11y/lib/screen_reader/speaker.h