mirror of
https://github.com/esphome/esphome.git
synced 2025-07-28 14:16:40 +00:00
[microphone] Bugfix: protect against starting mic if already started (#8656)
This commit is contained in:
parent
cdc77506de
commit
bf527b0331
@ -14,12 +14,16 @@ void MicrophoneSource::add_data_callback(std::function<void(const std::vector<ui
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MicrophoneSource::start() {
|
void MicrophoneSource::start() {
|
||||||
this->enabled_ = true;
|
if (!this->enabled_) {
|
||||||
this->mic_->start();
|
this->enabled_ = true;
|
||||||
|
this->mic_->start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
void MicrophoneSource::stop() {
|
void MicrophoneSource::stop() {
|
||||||
this->enabled_ = false;
|
if (this->enabled_) {
|
||||||
this->mic_->stop();
|
this->enabled_ = false;
|
||||||
|
this->mic_->stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint8_t> MicrophoneSource::process_audio_(const std::vector<uint8_t> &data) {
|
std::vector<uint8_t> MicrophoneSource::process_audio_(const std::vector<uint8_t> &data) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user