|
ESPHome 2026.2.1
|
#include <resampler_speaker.h>
Public Member Functions | |
| float | get_setup_priority () const override |
| 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 |
| void | set_pause_state (bool pause_state) override |
| bool | get_pause_state () const 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. | |
| bool | get_mute_state () override |
| void | set_volume (float volume) override |
| Volume state changes are passed to the parent's output speaker. | |
| float | get_volume () override |
| void | set_output_speaker (speaker::Speaker *speaker) |
| void | set_task_stack_in_psram (bool task_stack_in_psram) |
| void | set_target_bits_per_sample (uint8_t target_bits_per_sample) |
| void | set_target_sample_rate (uint32_t target_sample_rate) |
| void | set_filters (uint16_t filters) |
| void | set_taps (uint16_t taps) |
| void | set_buffer_duration (uint32_t buffer_duration_ms) |
Public Member Functions inherited from esphome::Component | |
| float | get_actual_setup_priority () const |
| void | set_setup_priority (float priority) |
| virtual float | get_loop_priority () const |
| priority of loop(). | |
| void | call () |
| virtual void | on_shutdown () |
| virtual void | on_safe_shutdown () |
| virtual bool | teardown () |
| Called during teardown to allow component to gracefully finish operations. | |
| virtual void | on_powerdown () |
| Called after teardown is complete to power down hardware. | |
| uint8_t | get_component_state () const |
| void | reset_to_construction_state () |
| Reset this component back to the construction state to allow setup to run again. | |
| bool | is_in_loop_state () const |
| Check if this component has completed setup and is in the loop state. | |
| bool | is_idle () const |
| Check if this component is idle. | |
| virtual void | mark_failed () |
| Mark this component as failed. | |
| ESPDEPRECATED ("Use mark_failed(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void mark_failed(const char *message) | |
| void | mark_failed (const LogString *message) |
| void | disable_loop () |
| Disable this component's loop. | |
| void | enable_loop () |
| Enable this component's loop. | |
| void | enable_loop_soon_any_context () |
| Thread and ISR-safe version of enable_loop() that can be called from any context. | |
| 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=nullptr) |
| void | status_set_warning (const LogString *message) |
| void | status_set_error () |
| ESPDEPRECATED ("Use status_set_error(LOG_STR(\"static string literal\")) instead. Do NOT use .c_str() from temporary " "strings. Will stop working in 2026.6.0", "2025.12.0") void status_set_error(const char *message) | |
| void | status_set_error (const LogString *message) |
| void | status_clear_warning () |
| void | status_clear_error () |
| void | status_momentary_warning (const char *name, uint32_t length=5000) |
| Set warning status flag and automatically clear it after a timeout. | |
| void | status_momentary_error (const char *name, uint32_t length=5000) |
| Set error status flag and automatically clear it after a timeout. | |
| bool | has_overridden_loop () const |
| void | set_component_source (const LogString *source) |
| Set where this component was loaded from for some debug messages. | |
| const LogString * | get_component_log_str () const |
| Get the integration where this component was declared as a LogString for logging. | |
| bool | should_warn_of_blocking (uint32_t blocking_time) |
Public Member Functions inherited from esphome::speaker::Speaker | |
| size_t | play (const std::vector< uint8_t > &data) |
| bool | is_running () const |
| bool | is_stopped () const |
| 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, int64_t)> &&callback) |
| Callback function for sending the duration of the audio written to the speaker since the last callback. | |
Protected Member Functions | |
| esp_err_t | start_ () |
| Starts the output speaker after setting the resampled stream info. | |
| esp_err_t | start_task_ () |
| Starts the resampler task after allocating the task stack. | |
| void | enter_stopping_state_ () |
| Transitions to STATE_STOPPING, records the stopping timestamp, sends the task stop command if the task is running, and stops the output speaker. | |
| void | set_start_error_ (esp_err_t err) |
| Sets the appropriate status error based on the start failure reason. | |
| void | delete_task_ () |
| Deletes the resampler task if suspended, deallocates the task stack, and resets the related pointers. | |
| void | send_command_ (uint32_t command_bit, bool wake_loop=false) |
| Sends a command via event group bits, enables the loop, and optionally wakes the main loop. | |
| bool | requires_resampling_ () const |
Protected Member Functions inherited from esphome::Component | |
| virtual void | call_loop () |
| virtual void | call_setup () |
| virtual void | call_dump_config () |
| void | set_component_state_ (uint8_t state) |
| Helper to set component state (clears state bits and sets new state) | |
| void | set_interval (uint32_t id, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a numeric ID (zero heap allocation). | |
| void | set_interval (InternalSchedulerID id, uint32_t interval, std::function< void()> &&f) |
| void | set_interval (uint32_t interval, std::function< void()> &&f) |
| bool | cancel_interval (uint32_t id) |
| bool | cancel_interval (InternalSchedulerID id) |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std | ESPDEPRECATED ("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const char *name |
| ESPDEPRECATED ("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(uint32_t id | |
| ESPDEPRECATED ("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(uint32_t initial_wait_time | |
| ESPDEPRECATED("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0") bool cancel_retry(const std | ESPDEPRECATED ("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0") bool cancel_retry(const char *name) |
| ESPDEPRECATED ("cancel_retry is deprecated and will be removed in 2026.8.0.", "2026.2.0") bool cancel_retry(uint32_t id) | |
| void | set_timeout (uint32_t id, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a numeric ID (zero heap allocation). | |
| void | set_timeout (InternalSchedulerID id, uint32_t timeout, std::function< void()> &&f) |
| void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
| bool | cancel_timeout (uint32_t id) |
| bool | cancel_timeout (InternalSchedulerID id) |
| void | defer (std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| void | defer (uint32_t id, std::function< void()> &&f) |
| Defer a callback with a numeric ID (zero heap allocation) | |
| bool | cancel_defer (uint32_t id) |
Static Protected Member Functions | |
| static void | resample_task (void *params) |
Protected Attributes | |
| EventGroupHandle_t | event_group_ {nullptr} |
| std::weak_ptr< RingBuffer > | ring_buffer_ |
| speaker::Speaker * | output_speaker_ {nullptr} |
| bool | task_stack_in_psram_ {false} |
| bool | waiting_for_output_ {false} |
| TaskHandle_t | task_handle_ {nullptr} |
| StaticTask_t | task_stack_ |
| StackType_t * | task_stack_buffer_ {nullptr} |
| audio::AudioStreamInfo | target_stream_info_ |
| uint16_t | taps_ |
| uint16_t | filters_ |
| uint8_t | target_bits_per_sample_ |
| uint32_t | target_sample_rate_ |
| uint32_t | buffer_duration_ms_ |
| uint32_t | state_start_ms_ {0} |
| uint64_t | callback_remainder_ {0} |
Protected Attributes inherited from esphome::Component | |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_interval(const std voi | set_interval )(const char *name, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a unique name. | |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_interval(const std boo | cancel_interval )(const char *name) |
| Cancel an interval function. | |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t | initial_wait_time |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t | max_attempts |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> && | f |
| ESPDEPRECATED("set_retry is deprecated and will be removed in 2026.8.0. Use set_timeout or set_interval instead.", "2026.2.0") void set_retry(const std uint32_t uint8_t std::function< RetryResult(uint8_t)> float | backoff_increase_factor = 1.0f) |
| uint32_t | initial_wait_time |
| uint32_t uint8_t | max_attempts |
| uint32_t uint8_t std::function< RetryResult(uint8_t)> && | f |
| uint32_t uint8_t std::function< RetryResult(uint8_t)> float | backoff_increase_factor = 1.0f) |
| uint8_t | max_attempts |
| uint8_t std::function< RetryResult(uint8_t)> && | f |
| uint8_t std::function< RetryResult(uint8_t)> float | backoff_increase_factor = 1.0f) |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") void set_timeout(const std voi | set_timeout )(const char *name, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a unique name. | |
| ESPDEPRECATED("Use const char* or uint32_t overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_timeout(const std boo | cancel_timeout )(const char *name) |
| Cancel a timeout function. | |
| ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") void defer(const std voi | defer )(const char *name, std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| ESPDEPRECATED("Use const char* overload instead. Removed in 2026.7.0", "2026.1.0") bool cancel_defer(const std boo | cancel_defer )(const char *name) |
| Cancel a defer callback using the specified name, name must not be empty. | |
| const LogString * | component_source_ {nullptr} |
| uint16_t | warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_MS} |
| Warn if blocked for this many ms (max 65.5s) | |
| uint8_t | component_state_ {0x00} |
| State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED, 0x04=LOOP_DONE) Bit 3: STATUS_LED_WARNING Bit 4: STATUS_LED_ERROR Bits 5-7: Unused - reserved for future expansion. | |
| volatile bool | pending_enable_loop_ {false} |
| ISR-safe flag for enable_loop_soon_any_context. | |
Protected Attributes inherited from esphome::speaker::Speaker | |
| State | state_ {STATE_STOPPED} |
| audio::AudioStreamInfo | audio_stream_info_ |
| float | volume_ {1.0f} |
| bool | mute_state_ {false} |
| audio_dac::AudioDac * | audio_dac_ {nullptr} |
| CallbackManager< void(uint32_t, int64_t)> | audio_output_callback_ {} |
Definition at line 17 of file resampler_speaker.h.
|
protected |
Deletes the resampler task if suspended, deallocates the task stack, and resets the related pointers.
Definition at line 314 of file resampler_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 43 of file resampler_speaker.cpp.
|
protected |
Transitions to STATE_STOPPING, records the stopping timestamp, sends the task stop command if the task is running, and stops the output speaker.
Definition at line 305 of file resampler_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 335 of file resampler_speaker.cpp.
|
inlineoverridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 38 of file resampler_speaker.h.
|
inlineoverridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 32 of file resampler_speaker.h.
|
inlineoverridevirtual |
Reimplemented from esphome::Component.
Definition at line 19 of file resampler_speaker.h.
|
inlineoverridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 42 of file resampler_speaker.h.
|
overridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 337 of file resampler_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 76 of file resampler_speaker.cpp.
|
inlineoverridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 25 of file resampler_speaker.h.
|
override |
Definition at line 224 of file resampler_speaker.cpp.
|
inlineprotected |
Definition at line 358 of file resampler_speaker.cpp.
|
staticprotected |
Definition at line 363 of file resampler_speaker.cpp.
|
protected |
Sends a command via event group bits, enables the loop, and optionally wakes the main loop.
Definition at line 246 of file resampler_speaker.cpp.
|
inline |
Definition at line 55 of file resampler_speaker.h.
|
inline |
Definition at line 52 of file resampler_speaker.h.
|
overridevirtual |
Mute state changes are passed to the parent's output speaker.
Reimplemented from esphome::speaker::Speaker.
Definition at line 348 of file resampler_speaker.cpp.
|
inline |
Definition at line 44 of file resampler_speaker.h.
|
inlineoverridevirtual |
Reimplemented from esphome::speaker::Speaker.
Definition at line 31 of file resampler_speaker.h.
|
protected |
Sets the appropriate status error based on the start failure reason.
Definition at line 210 of file resampler_speaker.cpp.
|
inline |
Definition at line 53 of file resampler_speaker.h.
|
inline |
Definition at line 47 of file resampler_speaker.h.
|
inline |
Definition at line 50 of file resampler_speaker.h.
|
inline |
Definition at line 45 of file resampler_speaker.h.
|
overridevirtual |
Volume state changes are passed to the parent's output speaker.
Reimplemented from esphome::speaker::Speaker.
Definition at line 353 of file resampler_speaker.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 51 of file resampler_speaker.cpp.
|
overridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 259 of file resampler_speaker.cpp.
|
protected |
Starts the output speaker after setting the resampled stream info.
If resampling is required, it starts the task.
Definition at line 261 of file resampler_speaker.cpp.
|
protected |
Starts the resampler task after allocating the task stack.
Definition at line 276 of file resampler_speaker.cpp.
|
overridevirtual |
Implements esphome::speaker::Speaker.
Definition at line 303 of file resampler_speaker.cpp.
|
protected |
Definition at line 107 of file resampler_speaker.h.
|
protected |
Definition at line 110 of file resampler_speaker.h.
|
protected |
Definition at line 86 of file resampler_speaker.h.
|
protected |
Definition at line 102 of file resampler_speaker.h.
|
protected |
Definition at line 90 of file resampler_speaker.h.
|
protected |
Definition at line 88 of file resampler_speaker.h.
|
protected |
Definition at line 108 of file resampler_speaker.h.
|
protected |
Definition at line 101 of file resampler_speaker.h.
|
protected |
Definition at line 104 of file resampler_speaker.h.
|
protected |
Definition at line 105 of file resampler_speaker.h.
|
protected |
Definition at line 99 of file resampler_speaker.h.
|
protected |
Definition at line 95 of file resampler_speaker.h.
|
protected |
Definition at line 96 of file resampler_speaker.h.
|
protected |
Definition at line 97 of file resampler_speaker.h.
|
protected |
Definition at line 92 of file resampler_speaker.h.
|
protected |
Definition at line 93 of file resampler_speaker.h.