ESPHome
2025.9.0-dev
Loading...
Searching...
No Matches
esphome
components
microphone
microphone.cpp
Go to the documentation of this file.
1
#include "
microphone.h
"
2
3
namespace
esphome
{
4
namespace
microphone {
5
6
void
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
esphome::microphone::Microphone::mute_state_
bool mute_state_
Definition
microphone.h:37
esphome::microphone::Microphone::data_callbacks_
CallbackManager< void(const std::vector< uint8_t > &)> data_callbacks_
Definition
microphone.h:41
esphome::microphone::Microphone::add_data_callback
void add_data_callback(std::function< void(const std::vector< uint8_t > &)> &&data_callback)
Definition
microphone.cpp:6
microphone.h
esphome
Providing packet encoding functions for exchanging data with a remote host.
Definition
a01nyub.cpp:7
Generated by
1.12.0