#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 >>(), bool supportsDavs=false) |
|
| AbstractKeywordDetector (std::shared_ptr< acsdkKWDInterfaces::KeywordNotifierInterface > keywordNotifier, std::shared_ptr< acsdkKWDInterfaces::KeywordDetectorStateNotifierInterface > keyWordDetectorStateNotifier, bool supportsDavs=false) |
|
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) |
|
bool | isDavsSupported () |
|
◆ ~AbstractKeywordDetector()
virtual alexaClientSDK::acsdkKWDImplementations::AbstractKeywordDetector::~AbstractKeywordDetector |
( |
| ) |
|
|
virtualdefault |
◆ AbstractKeywordDetector() [1/2]
- Deprecated:
- Constructor.
- Parameters
-
keyWordObservers | The observers to notify of keyword detections. |
keyWordDetectorStateObservers | The observers to notify of state changes in the engine. |
supportsDavs | Boolean to indicate whether keyword detector supports Davs or not. |
◆ AbstractKeywordDetector() [2/2]
Constructor.
- Parameters
-
keyWordNotifier | The object with which to notifiy observers of keyword detections. |
KeyWordDetectorStateNotifier | The object with which to notify observers of state changes in the engine. |
supportsDavs | Boolean to indicate whether keyword detector supports Davs or not. |
◆ addKeyWordDetectorStateObserver()
Adds the specified observer to the list of observers to notify of key word detector state changes. Observer will have onStateChanged called upon being added to notify of current detector state.
- 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()
static bool alexaClientSDK::acsdkKWDImplementations::AbstractKeywordDetector::isByteswappingRequired |
( |
avsCommon::utils::AudioFormat |
audioFormat | ) |
|
|
staticprotected |
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.
◆ isDavsSupported()
bool alexaClientSDK::acsdkKWDImplementations::AbstractKeywordDetector::isDavsSupported |
( |
| ) |
|
|
protected |
Checks to see whether keyword detector is compatible with DAVS.
- Returns
true
if Davs is supported 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::acsdkKWDImplementations::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::acsdkKWDImplementations::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 file:
AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Licensed under the Apache License, Version 2.0