ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
i2s_audio_speaker_standard.h
Go to the documentation of this file.
1#pragma once
2
3#ifdef USE_ESP32
4
5#include "i2s_audio_speaker.h"
6
7namespace esphome::i2s_audio {
8
9enum class I2SCommFmt : uint8_t {
10 STANDARD, // Philips / I2S standard
11 PCM, // PCM short
12 MSB, // MSB / left-justified
13};
14
18 public:
19 void dump_config() override;
20
22
23#ifdef USE_I2S_AUDIO_FULL_DUPLEX
24 void build_full_duplex_config(i2s_chan_config_t &chan_cfg, i2s_std_config_t &std_cfg) override;
25#endif
26
27 protected:
28 void run_speaker_task() override;
29 esp_err_t start_i2s_driver(audio::AudioStreamInfo &audio_stream_info) override;
30
33 void build_i2s_config_(const audio::AudioStreamInfo &output_stream_info, i2s_chan_config_t &chan_cfg,
34 i2s_std_config_t &std_cfg) const;
35
36#ifdef USE_I2S_AUDIO_FULL_DUPLEX
39#endif
40
43 return esp32_mono_swap_needed(stream_info) ? 2 : 1;
44 }
45
47};
48
49} // namespace esphome::i2s_audio
50
51#endif // USE_ESP32
Abstract base class for I2S audio speaker implementations.
Standard I2S speaker implementation.
audio::AudioStreamInfo full_duplex_stream_info_() const
The output format of a full duplex bus, fixed by the configuration since the channel is set up once.
static uint32_t dma_frame_multiple(const audio::AudioStreamInfo &stream_info)
Frame multiple for DMA buffers and writes; 2 keeps ESP32 mono sample pairs word-aligned.
esp_err_t start_i2s_driver(audio::AudioStreamInfo &audio_stream_info) override
void build_i2s_config_(const audio::AudioStreamInfo &output_stream_info, i2s_chan_config_t &chan_cfg, i2s_std_config_t &std_cfg) const
Builds the channel and standard mode configuration for the given output format.
void build_full_duplex_config(i2s_chan_config_t &chan_cfg, i2s_std_config_t &std_cfg) override
size_t size_t const char * fmt
Definition helpers.h:1180
static void uint32_t