@@ -281,12 +281,6 @@ void VoiceAssistant::loop() {
281
281
flags |= api::enums::VOICE_ASSISTANT_REQUEST_USE_WAKE_WORD;
282
282
if (this ->silence_detection_ )
283
283
flags |= api::enums::VOICE_ASSISTANT_REQUEST_USE_VAD;
284
- else {
285
- this ->speech_ms_left_ = this ->speech_ms_ ;
286
- this ->silence_ms_left_ = this ->silence_ms_ ;
287
- this ->timeout_ms_left_ = this ->timeout_ms_ ;
288
- this ->last_loop_ms_ = {};
289
- }
290
284
291
285
api::VoiceAssistantAudioSettings audio_settings;
292
286
audio_settings.noise_suppression_level = this ->noise_suppression_level_ ;
@@ -337,41 +331,6 @@ void VoiceAssistant::loop() {
337
331
}
338
332
available = this ->ring_buffer_ ->available ();
339
333
}
340
-
341
- #ifdef USE_MICRO_WAKE_WORD_VAD
342
- if (!this ->silence_detection_ ) {
343
- bool new_vad_state = false ;
344
- if (this ->micro_wake_word_ != nullptr ) {
345
- new_vad_state = this ->micro_wake_word_ ->get_vad_state ();
346
- }
347
-
348
- uint32_t new_loop_ms = millis ();
349
- if (this ->last_loop_ms_ .has_value ()) {
350
- uint32_t since_last_loop_ms = new_loop_ms - this ->last_loop_ms_ .value ();
351
-
352
- if (new_vad_state && this ->last_vad_state_ ) {
353
- // Speech
354
- this ->speech_ms_left_ -= since_last_loop_ms;
355
- this ->silence_ms_left_ = this ->silence_ms_ ;
356
- } else if (!new_vad_state && !this ->last_vad_state_ ) {
357
- // No speech
358
- this ->silence_ms_left_ -= since_last_loop_ms;
359
- }
360
-
361
- this ->timeout_ms_left_ -= since_last_loop_ms;
362
- }
363
- this ->last_loop_ms_ = new_loop_ms;
364
- this ->last_vad_state_ = new_vad_state;
365
-
366
- if ((this ->timeout_ms_left_ < 0 ) || ((this ->speech_ms_left_ < 0 ) && (this ->silence_ms_left_ < 0 ))) {
367
- this ->signal_stop_ ();
368
- // TODO: Both of these are hacky... protocol needs to be updated to handle this properly?
369
- this ->set_state_ (State::STOP_MICROPHONE, State::IDLE);
370
- // this->set_state_(State::STOP_MICROPHONE, State::AWAITING_RESPONSE);
371
- }
372
- #endif
373
- }
374
-
375
334
break ;
376
335
}
377
336
case State::STOP_MICROPHONE: {
@@ -922,7 +881,7 @@ void VoiceAssistant::on_announce(const api::VoiceAssistantAnnounceRequest &msg)
922
881
#endif
923
882
}
924
883
925
- void VoiceAssistant::on_set_configuration (const std::vector<std::string>& active_wake_words) {
884
+ void VoiceAssistant::on_set_configuration (const std::vector<std::string> & active_wake_words) {
926
885
if (this ->micro_wake_word_ ) {
927
886
// Disable all wake words first
928
887
for (auto &model : this ->micro_wake_word_ ->get_wake_words ()) {
@@ -934,9 +893,7 @@ void VoiceAssistant::on_set_configuration(const std::vector<std::string>& active
934
893
for (auto &model : this ->micro_wake_word_ ->get_wake_words ()) {
935
894
if (model->get_id () == ww_id) {
936
895
model->enable ();
937
- ESP_LOGD (TAG, " Enabled wake word: %s (id=%s)" ,
938
- model->get_wake_word ().c_str (),
939
- model->get_id ().c_str ());
896
+ ESP_LOGD (TAG, " Enabled wake word: %s (id=%s)" , model->get_wake_word ().c_str (), model->get_id ().c_str ());
940
897
}
941
898
}
942
899
}
@@ -968,7 +925,6 @@ const Configuration &VoiceAssistant::get_configuration() {
968
925
this ->config_ .max_active_wake_words = 0 ;
969
926
}
970
927
971
-
972
928
return this ->config_ ;
973
929
};
974
930
0 commit comments