16 #ifndef ACSDKSENSORYADAPTER_SENSORY_SENSORYKEYWORDDETECTOR_H_
17 #define ACSDKSENSORYADAPTER_SENSORY_SENSORYKEYWORDDETECTOR_H_
22 #include <unordered_set>
37 using namespace avsCommon;
38 using namespace avsCommon::avs;
39 using namespace avsCommon::sdkInterfaces;
60 static std::unique_ptr<SensoryKeywordDetector>
create(
61 const std::shared_ptr<AudioInputStream> stream,
62 const std::shared_ptr<avsCommon::utils::AudioFormat>& audioFormat,
63 std::shared_ptr<acsdkKWDInterfaces::KeywordNotifierInterface> keyWordNotifier,
64 std::shared_ptr<acsdkKWDInterfaces::KeywordDetectorStateNotifierInterface> KeyWordDetectorStateNotifier,
65 const std::string& modelFilePath,
66 std::chrono::milliseconds msToPushPerIteration = std::chrono::milliseconds(10));
86 static std::unique_ptr<SensoryKeywordDetector>
create(
87 const std::shared_ptr<AudioInputStream> stream,
89 std::unordered_set<std::shared_ptr<KeyWordObserverInterface>> keyWordObservers,
90 std::unordered_set<std::shared_ptr<KeyWordDetectorStateObserverInterface>> keyWordDetectorStateObservers,
91 const std::string& modelFilePath,
92 std::chrono::milliseconds msToPushPerIteration = std::chrono::milliseconds(10));
115 std::shared_ptr<AudioInputStream> stream,
116 const std::shared_ptr<acsdkKWDInterfaces::KeywordNotifierInterface> keywordNotifier,
117 const std::shared_ptr<acsdkKWDInterfaces::KeywordDetectorStateNotifierInterface> KeywordDetectorStateNotifier,
119 std::chrono::milliseconds msToPushPerIteration = std::chrono::milliseconds(10));
128 bool init(
const std::string& modelFilePath);
137 bool setUpRuntimeSettings(SnsrSession* session);
140 void detectionLoop();
150 static SnsrRC keyWordDetectedCallback(SnsrSession s,
const char*
key,
void* userData);
153 std::atomic<bool> m_isShuttingDown;
156 const std::shared_ptr<avsCommon::avs::AudioInputStream> m_stream;
159 std::shared_ptr<avsCommon::avs::AudioInputStream::Reader> m_streamReader;
168 std::thread m_detectionThread;
171 SnsrSession m_session;
177 const size_t m_maxSamplesPerPush;
183 #endif // ACSDKSENSORYADAPTER_SENSORY_SENSORYKEYWORDDETECTOR_H_