ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
microphone.cpp
Go to the documentation of this file.
1#include "microphone.h"
2
3namespace esphome {
4namespace microphone {
5
6void Microphone::add_data_callback(std::function<void(const std::vector<uint8_t> &)> &&data_callback) {
7 std::function<void(const std::vector<uint8_t> &)> mute_handled_callback =
8 [this, data_callback](const std::vector<uint8_t> &data) {
9 if (this->mute_state_) {
10 data_callback(std::vector<uint8_t>(data.size(), 0));
11 } else {
12 data_callback(data);
13 };
14 };
15 this->data_callbacks_.add(std::move(mute_handled_callback));
16}
17
18} // namespace microphone
19} // namespace esphome
CallbackManager< void(const std::vector< uint8_t > &)> data_callbacks_
Definition microphone.h:41
void add_data_callback(std::function< void(const std::vector< uint8_t > &)> &&data_callback)
Definition microphone.cpp:6
Providing packet encoding functions for exchanging data with a remote host.
Definition a01nyub.cpp:7