ESPHome  2024.4.0
Public Member Functions | Protected Attributes
esphome::microphone::Microphone Class Referenceabstract

#include <microphone.h>

Inheritance diagram for esphome::microphone::Microphone:
esphome::i2s_audio::I2SAudioMicrophone

Public Member Functions

virtual void start ()=0
 
virtual void stop ()=0
 
void add_data_callback (std::function< void(const std::vector< int16_t > &)> &&data_callback)
 
virtual size_t read (int16_t *buf, size_t len)=0
 
bool is_running () const
 
bool is_stopped () const
 

Protected Attributes

State state_ {STATE_STOPPED}
 
CallbackManager< void(const std::vector< int16_t > &)> data_callbacks_ {}
 

Detailed Description

Definition at line 16 of file microphone.h.

Member Function Documentation

◆ add_data_callback()

void esphome::microphone::Microphone::add_data_callback ( std::function< void(const std::vector< int16_t > &)> &&  data_callback)
inline

Definition at line 20 of file microphone.h.

◆ is_running()

bool esphome::microphone::Microphone::is_running ( ) const
inline

Definition at line 25 of file microphone.h.

◆ is_stopped()

bool esphome::microphone::Microphone::is_stopped ( ) const
inline

Definition at line 26 of file microphone.h.

◆ read()

virtual size_t esphome::microphone::Microphone::read ( int16_t *  buf,
size_t  len 
)
pure virtual

◆ start()

virtual void esphome::microphone::Microphone::start ( )
pure virtual

◆ stop()

virtual void esphome::microphone::Microphone::stop ( )
pure virtual

Field Documentation

◆ data_callbacks_

CallbackManager<void(const std::vector<int16_t> &)> esphome::microphone::Microphone::data_callbacks_ {}
protected

Definition at line 31 of file microphone.h.

◆ state_

State esphome::microphone::Microphone::state_ {STATE_STOPPED}
protected

Definition at line 29 of file microphone.h.


The documentation for this class was generated from the following file: