first commit
Some checks failed
Build Boards / Determine boards to build (push) Has been cancelled
Build Boards / Build ${{ matrix.board }} (push) Has been cancelled

This commit is contained in:
0Xiao0
2026-02-02 14:29:15 +08:00
commit 165219cee0
694 changed files with 37654 additions and 0 deletions

View File

@ -0,0 +1,42 @@
#ifndef ESP_WAKE_WORD_H
#define ESP_WAKE_WORD_H
#include <esp_wn_iface.h>
#include <esp_wn_models.h>
#include <model_path.h>
#include <string>
#include <vector>
#include <functional>
#include <atomic>
#include "audio_codec.h"
#include "wake_word.h"
class EspWakeWord : public WakeWord {
public:
EspWakeWord();
~EspWakeWord();
bool Initialize(AudioCodec* codec, srmodel_list_t* models_list);
void Feed(const std::vector<int16_t>& data);
void OnWakeWordDetected(std::function<void(const std::string& wake_word)> callback);
void Start();
void Stop();
size_t GetFeedSize();
void EncodeWakeWordData();
bool GetWakeWordOpus(std::vector<uint8_t>& opus);
const std::string& GetLastDetectedWakeWord() const { return last_detected_wake_word_; }
private:
esp_wn_iface_t *wakenet_iface_ = nullptr;
model_iface_data_t *wakenet_data_ = nullptr;
srmodel_list_t *wakenet_model_ = nullptr;
AudioCodec* codec_ = nullptr;
std::atomic<bool> running_ = false;
std::function<void(const std::string& wake_word)> wake_word_detected_callback_;
std::string last_detected_wake_word_;
};
#endif