#include <AbstractKeywordDetector.h>
|
| AbstractKeywordDetector (std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface >> keyWordObservers=std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordObserverInterface >>(), std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >> keyWordDetectorStateObservers=std::unordered_set< std::shared_ptr< avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface >>()) |
|
void | notifyKeyWordObservers (std::shared_ptr< avsCommon::avs::AudioInputStream > stream, std::string keyword, avsCommon::avs::AudioInputStream::Index beginIndex, avsCommon::avs::AudioInputStream::Index endIndex, std::shared_ptr< const std::vector< char >> KWDMetadata=nullptr) const |
|
void | notifyKeyWordDetectorStateObservers (avsCommon::sdkInterfaces::KeyWordDetectorStateObserverInterface::KeyWordDetectorState state) |
|
ssize_t | readFromStream (std::shared_ptr< avsCommon::avs::AudioInputStream::Reader > reader, std::shared_ptr< avsCommon::avs::AudioInputStream > stream, void *buf, size_t nWords, std::chrono::milliseconds timeout, bool *errorOccurred) |
|
◆ ~AbstractKeywordDetector()
virtual alexaClientSDK::kwd::AbstractKeywordDetector::~AbstractKeywordDetector |
( |
| ) |
|
|
virtualdefault |
◆ AbstractKeywordDetector()
Constructor.
- Parameters
-
keyWordObservers | The observers to notify of keyword detections. |
keyWordDetectorStateObservers | The observers to notify of state changes in the engine. |
◆ addKeyWordDetectorStateObserver()
Adds the specified observer to the list of observers to notify of key word detector state changes.
- Parameters
-
keyWordDetectorStateObserver | The observer to add. |
◆ addKeyWordObserver()
Adds the specified observer to the list of observers to notify of key word detection events.
- Parameters
-
keyWordObserver | The observer to add. |
◆ isByteswappingRequired()
Checks to see if the audioFormat
matches the platform endianness.
- Parameters
-
audioFormat | The audio format to check |
- Returns
true
if the endiannesses don't match and false
otherwise.
◆ notifyKeyWordDetectorStateObservers()
Notifies all keyword detector state observers of state changes in the derived detector.
- Parameters
-
state | The state of the detector. |
◆ notifyKeyWordObservers()
void alexaClientSDK::kwd::AbstractKeywordDetector::notifyKeyWordObservers |
( |
std::shared_ptr< avsCommon::avs::AudioInputStream > |
stream, |
|
|
std::string |
keyword, |
|
|
avsCommon::avs::AudioInputStream::Index |
beginIndex, |
|
|
avsCommon::avs::AudioInputStream::Index |
endIndex, |
|
|
std::shared_ptr< const std::vector< char >> |
KWDMetadata = nullptr |
|
) |
| const |
|
protected |
Notifies all keyword observers of the keyword detection.
- Parameters
-
stream | The stream in which the keyword was detected. |
keyword | The keyword detected. |
beginIndex | The absolute begin index of the first part of the keyword found within the stream . |
endIndex | The absolute end index of the last part of the keyword within the stream of the stream . |
KWDMetadata | Wake word engine metadata. |
◆ readFromStream()
ssize_t alexaClientSDK::kwd::AbstractKeywordDetector::readFromStream |
( |
std::shared_ptr< avsCommon::avs::AudioInputStream::Reader > |
reader, |
|
|
std::shared_ptr< avsCommon::avs::AudioInputStream > |
stream, |
|
|
void * |
buf, |
|
|
size_t |
nWords, |
|
|
std::chrono::milliseconds |
timeout, |
|
|
bool * |
errorOccurred |
|
) |
| |
|
protected |
Reads from the specified stream into the specified buffer and does the appropriate error checking and observer notifications.
- Parameters
-
| reader | The stream reader. This should be a blocking reader. |
| buf | The buffer to read into. |
| nWords | The number of words to read. |
| timeout | The amount of time to wait for data to become available. |
[out] | errorOccurred | Lets caller know if there were any errors that occurred with the read call. |
- Returns
- The number of words successfully read.
◆ removeKeyWordDetectorStateObserver()
Removes the specified observer to the list of observers to notify of key word detector state changes.
- Parameters
-
keyWordDetectorStateObserver | The observer to remove. |
◆ removeKeyWordObserver()
Removes the specified observer to the list of observers to notify of key word detection events.
- Parameters
-
keyWordObserver | The observer to remove. |
The documentation for this class was generated from the following files:
AlexaClientSDK 1.25.0 - Copyright 2016-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0