3 #ifdef USE_ESP32_FRAMEWORK_ARDUINO 10 static const char *
const TAG =
"audio";
21 if (this->
audio_->isRunning()) {
25 this->
state = play_state;
49 float new_volume = this->
volume + 0.1f;
50 if (new_volume > 1.0f)
57 float new_volume = this->
volume - 0.1f;
58 if (new_volume < 0.0f)
72 if (!this->
audio_->isRunning())
73 this->
audio_->pauseResume();
74 this->
state = play_state;
77 if (this->
audio_->isRunning())
78 this->
audio_->pauseResume();
85 this->
audio_->pauseResume();
86 if (this->
audio_->isRunning()) {
116 if (this->
audio_ !=
nullptr)
117 this->
audio_->setVolume(remap<uint8_t, float>(volume, 0.0f, 1.0f, 0, 21));
123 ESP_LOGCONFIG(TAG,
"Setting up Audio...");
147 !this->
audio_->isRunning()) {
154 if (!this->
parent_->try_lock()) {
158 #if SOC_I2S_SUPPORTS_DAC 163 this->
audio_ = make_unique<Audio>(
false, 3, this->
parent_->get_port());
165 i2s_pin_config_t pin_config = this->
parent_->get_pin_config();
166 pin_config.data_out_num = this->
dout_pin_;
167 i2s_set_pin(this->
parent_->get_port(), &pin_config);
175 #if SOC_I2S_SUPPORTS_DAC 181 this->
audio_->setVolume(remap<uint8_t, float>(this->
volume, 0.0f, 1.0f, 0, 21));
202 if (this->
audio_->isRunning()) {
220 traits.set_supports_pause(
true);
225 ESP_LOGCONFIG(TAG,
"Audio:");
227 ESP_LOGCONFIG(TAG,
"Audio failed to initialize!");
230 #if SOC_I2S_SUPPORTS_DAC 233 case I2S_DAC_CHANNEL_LEFT_EN:
234 ESP_LOGCONFIG(TAG,
" Internal DAC mode: Left");
236 case I2S_DAC_CHANNEL_RIGHT_EN:
237 ESP_LOGCONFIG(TAG,
" Internal DAC mode: Right");
239 case I2S_DAC_CHANNEL_BOTH_EN:
240 ESP_LOGCONFIG(TAG,
" Internal DAC mode: Left & Right");
248 ESP_LOGCONFIG(TAG,
" I2S DOUT Pin: %d", this->
dout_pin_);
250 #if SOC_I2S_SUPPORTS_DAC 258 #endif // USE_ESP32_FRAMEWORK_ARDUINO virtual void digital_write(bool value)=0
value_type const & value() const
I2SAudioComponent * parent_
void start()
Start running the loop continuously.
void stop()
Stop running the loop continuously.
Implementation of SPI Controller mode.