mirror of
https://github.com/esphome/esphome.git
synced 2024-11-21 14:38:10 +01:00
Move setting global voice assistant to constructor (#7630)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
This commit is contained in:
parent
3ebdd62c67
commit
d95b370998
2 changed files with 4 additions and 7 deletions
|
@ -23,6 +23,8 @@ static const size_t SEND_BUFFER_SIZE = INPUT_BUFFER_SIZE * sizeof(int16_t);
|
|||
static const size_t RECEIVE_SIZE = 1024;
|
||||
static const size_t SPEAKER_BUFFER_SIZE = 16 * RECEIVE_SIZE;
|
||||
|
||||
VoiceAssistant::VoiceAssistant() { global_voice_assistant = this; }
|
||||
|
||||
float VoiceAssistant::get_setup_priority() const { return setup_priority::AFTER_CONNECTION; }
|
||||
|
||||
bool VoiceAssistant::start_udp_socket_() {
|
||||
|
@ -68,12 +70,6 @@ bool VoiceAssistant::start_udp_socket_() {
|
|||
return true;
|
||||
}
|
||||
|
||||
void VoiceAssistant::setup() {
|
||||
ESP_LOGCONFIG(TAG, "Setting up Voice Assistant...");
|
||||
|
||||
global_voice_assistant = this;
|
||||
}
|
||||
|
||||
bool VoiceAssistant::allocate_buffers_() {
|
||||
if (this->send_buffer_ != nullptr) {
|
||||
return true; // Already allocated
|
||||
|
|
|
@ -91,7 +91,8 @@ struct Configuration {
|
|||
|
||||
class VoiceAssistant : public Component {
|
||||
public:
|
||||
void setup() override;
|
||||
VoiceAssistant();
|
||||
|
||||
void loop() override;
|
||||
float get_setup_priority() const override;
|
||||
void start_streaming();
|
||||
|
|
Loading…
Reference in a new issue