diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-01-30 15:52:54 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-01-30 15:52:54 +1100 |
| commit | ef8d404b15e6d32506617a95aa3161fbe59ecdaf (patch) | |
| tree | f05d5f0a81b1477846e85bf44f0154db015b9789 /src/audio/i2s_audio_output.cpp | |
| parent | 2cc0a38a1ac7fc54d7333dafa8b99479a7f5dc86 (diff) | |
| download | tangara-fw-ef8d404b15e6d32506617a95aa3161fbe59ecdaf.tar.gz | |
Continue ironing out i2s pipeline
still at least one heap corruption issue, plus the i2s write method
seems to block forever :/
Diffstat (limited to 'src/audio/i2s_audio_output.cpp')
| -rw-r--r-- | src/audio/i2s_audio_output.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/audio/i2s_audio_output.cpp b/src/audio/i2s_audio_output.cpp index f499d50f..bfc88588 100644 --- a/src/audio/i2s_audio_output.cpp +++ b/src/audio/i2s_audio_output.cpp @@ -48,7 +48,8 @@ auto I2SAudioOutput::ProcessStreamInfo(const StreamInfo& info) -> cpp::result<void, AudioProcessingError> { // TODO(jacqueline): probs do something with the channel hey - if (!info.bits_per_sample && !info.sample_rate) { + if (!info.bits_per_sample || !info.sample_rate) { + ESP_LOGE(kTag, "audio stream missing bits or sample rate"); return cpp::fail(UNSUPPORTED_STREAM); } @@ -67,6 +68,7 @@ auto I2SAudioOutput::ProcessStreamInfo(const StreamInfo& info) bps = drivers::AudioDac::BPS_32; break; default: + ESP_LOGE(kTag, "dropping stream with unknown bps"); return cpp::fail(UNSUPPORTED_STREAM); } @@ -79,6 +81,7 @@ auto I2SAudioOutput::ProcessStreamInfo(const StreamInfo& info) sample_rate = drivers::AudioDac::SAMPLE_RATE_48; break; default: + ESP_LOGE(kTag, "dropping stream with unknown rate"); return cpp::fail(UNSUPPORTED_STREAM); } @@ -93,11 +96,13 @@ auto I2SAudioOutput::ProcessChunk(const cpp::span<std::byte>& chunk) SetSoftMute(false); // TODO(jacqueline): write smaller parts with a small delay so that we can // be responsive to pause and seek commands. - return dac_->WriteData(chunk, portMAX_DELAY); + std::size_t bytes_written = dac_->WriteData(chunk, portMAX_DELAY); + ESP_LOGI(kTag, "played %u bytes", bytes_written); + return 0; } auto I2SAudioOutput::Process() -> cpp::result<void, AudioProcessingError> { - // TODO(jacqueline): Consider powering down the dac completely maybe? + // TODO(jacqueline): Play the stream in smaller sections return {}; } |
