ESPHome
2025.2.0
|
#include <mixer_speaker.h>
Public Member Functions | |
void | dump_config () override |
void | setup () override |
void | loop () override |
size_t | play (const uint8_t *data, size_t length, TickType_t ticks_to_wait) override |
size_t | play (const uint8_t *data, size_t length) override |
void | start () override |
void | stop () override |
void | finish () override |
bool | has_buffered_data () const override |
void | set_mute_state (bool mute_state) override |
Mute state changes are passed to the parent's output speaker. More... | |
void | set_volume (float volume) override |
Volume state changes are passed to the parent's output speaker. More... | |
void | set_pause_state (bool pause_state) override |
bool | get_pause_state () const override |
size_t | process_data_from_source (TickType_t ticks_to_wait) |
Transfers audio from the ring buffer into the transfer buffer. More... | |
void | apply_ducking (uint8_t decibel_reduction, uint32_t duration) |
Sets the ducking level for the source speaker. More... | |
void | set_buffer_duration (uint32_t buffer_duration_ms) |
void | set_parent (MixerSpeaker *parent) |
void | set_timeout (uint32_t ms) |
std::weak_ptr< audio::AudioSourceTransferBuffer > | get_transfer_buffer () |
![]() | |
size_t | play (const std::vector< uint8_t > &data) |
bool | is_running () const |
bool | is_stopped () const |
float | get_volume () |
bool | get_mute_state () |
void | set_audio_dac (audio_dac::AudioDac *audio_dac) |
void | set_audio_stream_info (const audio::AudioStreamInfo &audio_stream_info) |
audio::AudioStreamInfo & | get_audio_stream_info () |
void | add_audio_output_callback (std::function< void(uint32_t, uint32_t, uint32_t, uint32_t)> &&callback) |
Callback function for sending the duration of the audio written to the speaker since the last callback. More... | |
![]() | |
virtual float | get_setup_priority () const |
priority of setup(). More... | |
float | get_actual_setup_priority () const |
void | set_setup_priority (float priority) |
virtual float | get_loop_priority () const |
priority of loop(). More... | |
void | call () |
virtual void | on_shutdown () |
virtual void | on_safe_shutdown () |
uint32_t | get_component_state () const |
virtual void | mark_failed () |
Mark this component as failed. More... | |
bool | is_failed () const |
bool | is_ready () const |
virtual bool | can_proceed () |
bool | status_has_warning () const |
bool | status_has_error () const |
void | status_set_warning (const char *message="unspecified") |
void | status_set_error (const char *message="unspecified") |
void | status_clear_warning () |
void | status_clear_error () |
void | status_momentary_warning (const std::string &name, uint32_t length=5000) |
void | status_momentary_error (const std::string &name, uint32_t length=5000) |
bool | has_overridden_loop () const |
void | set_component_source (const char *source) |
Set where this component was loaded from for some debug messages. More... | |
const char * | get_component_source () const |
Get the integration where this component was declared as a string. More... | |
Protected Member Functions | |
esp_err_t | start_ () |
void | stop_ () |
![]() | |
virtual void | call_loop () |
virtual void | call_setup () |
virtual void | call_dump_config () |
void | set_interval (const std::string &name, uint32_t interval, std::function< void()> &&f) |
Set an interval function with a unique name. More... | |
void | set_interval (uint32_t interval, std::function< void()> &&f) |
bool | cancel_interval (const std::string &name) |
Cancel an interval function. More... | |
void | set_retry (const std::string &name, uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
Set an retry function with a unique name. More... | |
void | set_retry (uint32_t initial_wait_time, uint8_t max_attempts, std::function< RetryResult(uint8_t)> &&f, float backoff_increase_factor=1.0f) |
bool | cancel_retry (const std::string &name) |
Cancel a retry function. More... | |
void | set_timeout (const std::string &name, uint32_t timeout, std::function< void()> &&f) |
Set a timeout function with a unique name. More... | |
void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
bool | cancel_timeout (const std::string &name) |
Cancel a timeout function. More... | |
void | defer (const std::string &name, std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
void | defer (std::function< void()> &&f) |
Defer a callback to the next loop() call. More... | |
bool | cancel_defer (const std::string &name) |
Cancel a defer callback using the specified name, name must not be empty. More... | |
Static Protected Member Functions | |
static void | duck_samples (int16_t *input_buffer, uint32_t input_samples_to_duck, int8_t *current_ducking_db_reduction, uint32_t *ducking_transition_samples_remaining, uint32_t samples_per_ducking_step, int8_t db_change_per_ducking_step) |
Ducks audio samples by a specified amount. More... | |
Definition at line 39 of file mixer_speaker.h.
void esphome::mixer_speaker::SourceSpeaker::apply_ducking | ( | uint8_t | decibel_reduction, |
uint32_t | duration | ||
) |
Sets the ducking level for the source speaker.
decibel_reduction | (uint8_t) The dB reduction level. For example, 0 is no change, 10 is a reduction by 10 dB |
duration | (uint32_t) The number of milliseconds to transition from the current level to the new level |
Definition at line 207 of file mixer_speaker.cpp.
|
staticprotected |
Ducks audio samples by a specified amount.
When changing the ducking amount, it can transition gradually over a specified amount of samples.
input_buffer | buffer with audio samples to be ducked in place |
input_samples_to_duck | number of samples to process in input_buffer |
current_ducking_db_reduction | pointer to the current dB reduction |
ducking_transition_samples_remaining | pointer to the total number of samples left before the the transition is finished |
samples_per_ducking_step | total number of samples per ducking step for the transition |
db_change_per_ducking_step | the change in dB reduction per step |
Definition at line 238 of file mixer_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 45 of file mixer_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 169 of file mixer_speaker.cpp.
|
inlineoverridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 61 of file mixer_speaker.h.
|
inline |
Definition at line 77 of file mixer_speaker.h.
|
overridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 171 of file mixer_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 66 of file mixer_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 116 of file mixer_speaker.cpp.
|
inlineoverridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 46 of file mixer_speaker.h.
size_t esphome::mixer_speaker::SourceSpeaker::process_data_from_source | ( | TickType_t | ticks_to_wait | ) |
Transfers audio from the ring buffer into the transfer buffer.
Ducks audio while transferring.
ticks_to_wait | FreeRTOS ticks to wait while waiting to read from the ring buffer. |
Definition at line 185 of file mixer_speaker.cpp.
|
inline |
Definition at line 73 of file mixer_speaker.h.
|
overridevirtual |
Mute state changes are passed to the parent's output speaker.
Reimplemented from esphome::speaker::Speaker.
Definition at line 175 of file mixer_speaker.cpp.
|
inline |
Definition at line 74 of file mixer_speaker.h.
|
inlineoverridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 60 of file mixer_speaker.h.
|
inline |
Definition at line 75 of file mixer_speaker.h.
|
overridevirtual |
Volume state changes are passed to the parent's output speaker.
Reimplemented from esphome::speaker::Speaker.
Definition at line 180 of file mixer_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 55 of file mixer_speaker.cpp.
|
overridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 131 of file mixer_speaker.cpp.
|
protected |
Definition at line 133 of file mixer_speaker.cpp.
|
overridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 159 of file mixer_speaker.cpp.
|
protected |
Definition at line 165 of file mixer_speaker.cpp.
|
protected |
Definition at line 115 of file mixer_speaker.h.
|
protected |
Definition at line 102 of file mixer_speaker.h.
|
protected |
Definition at line 110 of file mixer_speaker.h.
|
protected |
Definition at line 111 of file mixer_speaker.h.
|
protected |
Definition at line 112 of file mixer_speaker.h.
|
protected |
Definition at line 103 of file mixer_speaker.h.
|
protected |
Definition at line 97 of file mixer_speaker.h.
|
protected |
Definition at line 107 of file mixer_speaker.h.
|
protected |
Definition at line 117 of file mixer_speaker.h.
|
protected |
Definition at line 100 of file mixer_speaker.h.
|
protected |
Definition at line 113 of file mixer_speaker.h.
|
protected |
Definition at line 105 of file mixer_speaker.h.
|
protected |
Definition at line 109 of file mixer_speaker.h.
|
protected |
Definition at line 104 of file mixer_speaker.h.
|
protected |
Definition at line 99 of file mixer_speaker.h.