AlexaClientSDK
3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
|
#include <SpeechSynthesizer.h>
Public Types | |
using | SpeechSynthesizerObserverInterface = avsCommon::sdkInterfaces::SpeechSynthesizerObserverInterface |
Alias to the SpeechSynthesizerObserverInterface for brevity. More... | |
Public Types inherited from alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface | |
enum | DialogUXState { DialogUXState::IDLE, DialogUXState::LISTENING, DialogUXState::EXPECTING, DialogUXState::THINKING, DialogUXState::SPEAKING, DialogUXState::FINISHED } |
The different dialog specific AVS UX states. More... | |
Public Types inherited from alexaClientSDK::avsCommon::utils::mediaPlayer::MediaPlayerObserverInterface | |
enum | TagType { TagType::STRING, TagType::UINT, TagType::INT, TagType::DOUBLE, TagType::BOOLEAN } |
The different types of metadata "stream tags". More... | |
using | SourceId = MediaPlayerInterface::SourceId |
A type that identifies which source is currently being operated on. More... | |
typedef std::vector< TagKeyValueType > | VectorOfTags |
Additional Inherited Members | |
Protected Member Functions inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent | |
CapabilityAgent (const std::string &nameSpace, std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > exceptionEncounteredSender) | |
virtual std::shared_ptr< DirectiveInfo > | createDirectiveInfo (std::shared_ptr< AVSDirective > directive, std::unique_ptr< sdkInterfaces::DirectiveHandlerResultInterface > result) |
void | removeDirective (const std::string &messageId) |
void | sendExceptionEncounteredAndReportFailed (std::shared_ptr< DirectiveInfo > info, const std::string &message, avsCommon::avs::ExceptionErrorType type=avsCommon::avs::ExceptionErrorType::INTERNAL_ERROR) |
const std::pair< std::string, std::string > | buildJsonEventString (const std::string &eventName, const std::string &dialogRequestIdString="", const std::string &payload="{}", const std::string &context="") const |
Protected Attributes inherited from alexaClientSDK::avsCommon::avs::CapabilityAgent | |
const std::string | m_namespace |
The namespace of the capability agent. More... | |
std::shared_ptr< sdkInterfaces::ExceptionEncounteredSenderInterface > | m_exceptionEncounteredSender |
Object to use to send exceptionEncountered messages. More... | |
This class implements the SpeechSynthesizer capability agent.
using alexaClientSDK::capabilityAgents::speechSynthesizer::SpeechSynthesizer::SpeechSynthesizerObserverInterface = avsCommon::sdkInterfaces::SpeechSynthesizerObserverInterface |
Alias to the SpeechSynthesizerObserverInterface
for brevity.
void alexaClientSDK::capabilityAgents::speechSynthesizer::SpeechSynthesizer::addObserver | ( | std::shared_ptr< SpeechSynthesizerObserverInterface > | observer | ) |
Add an observer to the SpeechSynthesizer.
observer | The observer to add. |
|
overridevirtual |
Cancel an ongoing preHandleDirective()
or handleDirective()
operation for the AVSDirective
in . Once this has been called the CapabilityAgent
should not expect to receive further calls regarding this directive.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
static |
Create a new SpeechSynthesizer
instance.
mediaPlayer | The instance of the MediaPlayerInterface used to play audio. |
messageSender | The instance of the MessageSenderInterface used to send events to AVS. |
focusManager | The instance of the FocusManagerInterface used to acquire focus of a channel. |
contextManager | The instance of the ContextObserverInterface to use to set the context of the SpeechSynthesizer . |
metricRecorder | The instance of the MetricRecorderInterface used to record metrics |
exceptionSender | The instance of the ExceptionEncounteredSenderInterface to use to notify AVS when a directive cannot be processed. |
captionManager | The optional CaptionManagerInterface instance to use for handling captions. |
powerResourceManager | Power Resource Manager. |
SpeechSynthesizer
, or nullptr
if the operation failed.
|
static |
Create a new SpeechSynthesizer
instance.
audioPipelineFactory | The instance of ApplicationAudioPipelineFactoryInterface to create the speak media player and related interfaces. |
messageSender | The instance of the MessageSenderInterface used to send events to AVS. |
focusManager | The instance of the FocusManagerInterface used to acquire focus of a channel. |
contextManager | The instance of the ContextObserverInterface to use to set the context of the SpeechSynthesizer . |
metricRecorder | The instance of the MetricRecorderInterface used to record metrics |
exceptionSender | The instance of the ExceptionEncounteredSenderInterface to use to notify AVS when a directive cannot be processed. |
captionManager | The optional CaptionManagerInterface instance to use for handling captions. |
powerResourceManager | Power Resource Manager. |
SpeechSynthesizer
, or nullptr
if the operation failed.
|
overridevirtual |
Returns the configurations of the capability interfaces being implemented.
Implements alexaClientSDK::avsCommon::sdkInterfaces::CapabilityConfigurationInterface.
|
overridevirtual |
Returns the configuration of the directive handler.
The configuration consists of multiple directive routing rules and their respective blocking policy. The directives will be matched from the most specific rule (with all fields defined) to the least specific rule (which only matches the directive endpointId).
avs::DirectiveHandlerConfiguration
of the handler. Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
|
overridevirtual |
Handle the action specified by the AVSDirective
in info
. The handling of subsequent directives with the same DialogRequestId
may be blocked until the DirectiveHandler
calls the setSucceeded()
method of the DirectiveHandlingResult
present in info
. If handling of this directive fails setFailed()
should be called to indicate a failure.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
Handle the action specified AVSDirective
. Once this has been called the DirectiveHandler
should not expect to receive further calls regarding this directive.
AVSDirectives
. ExceptionEncountered
message should be sent to AVS.directive | The directive to handle. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::DirectiveHandlerInterface.
|
override |
|
overridevirtual |
This is called by the ContextManager once the context is ready and available.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
.jsonContext | Context information.Context provided is of the format {"context"[{...}, {...}]} |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overridevirtual |
The contextManager calls this if it is unable to process a getContext
request successfully.
ContextRequester
should perform minimum processing and return quickly. Otherwise it will block the processing of updating the of other ContextProviders
.error | The reason why the getContext request failed. |
Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::ContextRequesterInterface.
|
overridevirtual |
Notification that this handler has been de-registered and will not receive any more calls.
Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
This function is called whenever the AVS UX dialog state of the system changes. This function will block processing of other state changes, so any implementation of this should return quickly.
newState | The new dialog specific AVS UX state. |
Implements alexaClientSDK::avsCommon::sdkInterfaces::DialogUXStateObserverInterface.
|
override |
|
overridevirtual |
Used to notify the observer of the Channel of focus changes. Once called, the client should make a user observable change only and return immediately. Any additional work that needs to be done should be done on a separate thread or after returning. "User observable change" here refers to events that the end user of the product can visibly see or hear. For example, Alexa speech or music playing would be examples of user observable changes. Other work, such as database storing, logging, or communicating via network should be done on a different thread. Not doing so could result in delays for other clients trying to access the Channel.
newFocus | The new Focus of the channel. |
behavior | The mixingBehavior for the ChannelObserver to take as per the interrupt model |
Reimplemented from alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
override |
|
override |
|
override |
|
override |
|
overridevirtual |
Notification that a directive has arrived. This notification gives the DirectiveHandler a chance to prepare for handling of an AVSDirective
. If an error occurs during the pre-Handling phase and that error should cancel the handling of subsequent AVSDirectives
with the same DialogRequestId
, the DirectiveHandler
should call the setFailed
method on the result
instance passed in to this call.
AVSDirectives
.info | The DirectiveInfo instance for the AVSDirective to process. |
Implements alexaClientSDK::avsCommon::avs::CapabilityAgent.
|
overridevirtual |
A request to a StateProvider
to provide the state. The StateProvider
should perform minimum processing and return quickly, otherwise it will block the processing of updating the states of other StateProviders
. The ContextManager
specifies a token which it uses to track the getContext
request associated with this provideState
request. The stateProviderInterface
must use the same token when it updates its state via the setState
call.
: The setState method MUST be called from a different thread from where the provideState method is being called from.
stateProviderName | The name of the state provider. |
stateRequestToken | The token to use in the setState call. |
NamespaceAndName
is being deprecated. Use the CapabilityMessageIdentifier version instead. Reimplemented from alexaClientSDK::avsCommon::sdkInterfaces::StateProviderInterface.
void alexaClientSDK::capabilityAgents::speechSynthesizer::SpeechSynthesizer::removeObserver | ( | std::shared_ptr< SpeechSynthesizerObserverInterface > | observer | ) |
Remove an observer from the SpeechSynthesizer.
removeObserver()
from SpeechSynthesizerObserverInterface::onStateChanged()
will result in a deadlock.observer | The observer to remove. |
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0