1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-08 14:22:21 +01:00

[voice_assistant] Use mic callback and remove esp_adf code (#8627)

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
Kevin Ahrendt
2025-04-27 19:15:28 -05:00
committed by GitHub
parent c9d1476ae0
commit e49252ca3d
3 changed files with 22 additions and 129 deletions

View File

@@ -20,10 +20,6 @@
#endif
#include "esphome/components/socket/socket.h"
#ifdef USE_ESP_ADF
#include <esp_vad.h>
#endif
#include <unordered_map>
#include <vector>
@@ -96,6 +92,7 @@ class VoiceAssistant : public Component {
VoiceAssistant();
void loop() override;
void setup() override;
float get_setup_priority() const override;
void start_streaming();
void start_streaming(struct sockaddr_storage *addr, uint16_t port);
@@ -163,9 +160,6 @@ class VoiceAssistant : public Component {
bool is_continuous() const { return this->continuous_; }
void set_use_wake_word(bool use_wake_word) { this->use_wake_word_ = use_wake_word; }
#ifdef USE_ESP_ADF
void set_vad_threshold(uint8_t vad_threshold) { this->vad_threshold_ = vad_threshold; }
#endif
void set_noise_suppression_level(uint8_t noise_suppression_level) {
this->noise_suppression_level_ = noise_suppression_level;
@@ -214,7 +208,6 @@ class VoiceAssistant : public Component {
void clear_buffers_();
void deallocate_buffers_();
int read_microphone_();
void set_state_(State state);
void set_state_(State state, State desired_state);
void signal_stop_();
@@ -279,13 +272,6 @@ class VoiceAssistant : public Component {
std::string wake_word_{""};
HighFrequencyLoopRequester high_freq_;
#ifdef USE_ESP_ADF
vad_handle_t vad_instance_;
uint8_t vad_threshold_{5};
uint8_t vad_counter_{0};
#endif
std::shared_ptr<RingBuffer> ring_buffer_;
bool use_wake_word_;
@@ -295,7 +281,6 @@ class VoiceAssistant : public Component {
uint32_t conversation_timeout_;
uint8_t *send_buffer_{nullptr};
int16_t *input_buffer_{nullptr};
bool continuous_{false};
bool silence_detection_;