5 #include "../i2s_audio.h" 7 #include <driver/i2s.h> 9 #include <freertos/event_groups.h> 10 #include <freertos/queue.h> 11 #include <freertos/FreeRTOS.h> 28 void setup()
override;
34 #if SOC_I2S_SUPPORTS_DAC 39 void start()
override;
49 size_t play(
const uint8_t *data,
size_t length, TickType_t ticks_to_wait)
override;
50 size_t play(
const uint8_t *data,
size_t length)
override {
return play(data, length, 0); }
79 void stop_(
bool wait_on_empty);
127 #if SOC_I2S_SUPPORTS_DAC size_t play(const uint8_t *data, size_t length, TickType_t ticks_to_wait) override
Plays the provided audio data.
void set_timeout(uint32_t ms)
EventGroupHandle_t event_group_
void stop_(bool wait_on_empty)
Sends a stop command to the speaker task via event_group_.
bool send_esp_err_to_event_group_(esp_err_t err)
Sets the corresponding ERR_ESP event group bits.
esp_err_t allocate_buffers_(size_t data_buffer_size, size_t ring_buffer_size)
Allocates the data buffer and ring buffer.
static void speaker_task(void *params)
Function for the FreeRTOS task handling audio output.
void set_i2s_comm_fmt(i2s_comm_format_t mode)
void set_volume(float volume) override
Sets the volume of the speaker.
i2s_dac_mode_t internal_dac_mode_
void set_buffer_duration(uint32_t buffer_duration_ms)
esp_err_t start_i2s_driver_(audio::AudioStreamInfo &audio_stream_info)
Starts the ESP32 I2S driver.
TaskHandle_t speaker_task_handle_
BedjetMode mode
BedJet operating mode.
optional< uint32_t > timeout_
void set_mute_state(bool mute_state) override
Mutes or unmute the speaker.
size_t play(const uint8_t *data, size_t length) override
const float PROCESSOR
For components that use data from sensors like displays.
float get_setup_priority() const override
void set_dout_pin(uint8_t pin)
void delete_task_(size_t buffer_size)
Deletes the speaker's task.
std::shared_ptr< RingBuffer > audio_ring_buffer_
Implementation of SPI Controller mode.
bool has_buffered_data() const override
QueueHandle_t i2s_event_queue_
void set_internal_dac_mode(i2s_dac_mode_t mode)
uint32_t buffer_duration_ms_
i2s_comm_format_t i2s_comm_fmt_
int16_t q15_volume_factor_