summaryrefslogtreecommitdiff
path: root/src/audio/audio_decoder.cpp
diff options
context:
space:
mode:
authorjacqueline <me@jacqueline.id.au>2023-09-26 17:23:34 +1000
committerjacqueline <me@jacqueline.id.au>2023-09-26 17:23:34 +1000
commit8608f9367fc29e498f42f5249aa248dd2044d567 (patch)
treec8564bfe6bbc6c5a9413bbd29b4e52f2cf3bd35c /src/audio/audio_decoder.cpp
parent4d99d22e10a3cb2a421da1618c127128816613c9 (diff)
downloadtangara-fw-8608f9367fc29e498f42f5249aa248dd2044d567.tar.gz
Tune buffer sizes and locations for I2S
Diffstat (limited to 'src/audio/audio_decoder.cpp')
-rw-r--r--src/audio/audio_decoder.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/audio/audio_decoder.cpp b/src/audio/audio_decoder.cpp
index bacd5cde..7751bf37 100644
--- a/src/audio/audio_decoder.cpp
+++ b/src/audio/audio_decoder.cpp
@@ -26,6 +26,7 @@
#include "freertos/projdefs.h"
#include "freertos/queue.h"
#include "freertos/ringbuf.h"
+#include "i2s_dac.hpp"
#include "span.hpp"
#include "audio_converter.hpp"
@@ -46,7 +47,8 @@ namespace audio {
static const char* kTag = "audio_dec";
-static constexpr std::size_t kCodecBufferLength = 240 * 4 * 64;
+static constexpr std::size_t kCodecBufferLength =
+ drivers::kI2SBufferLengthFrames * sizeof(sample::Sample) * 2;
Timer::Timer(const codecs::ICodec::OutputFormat& format)
: current_seconds_(0),
@@ -93,7 +95,7 @@ Decoder::Decoder(std::shared_ptr<IAudioSource> source,
ESP_LOGI(kTag, "allocating codec buffer, %u KiB", kCodecBufferLength / 1024);
codec_buffer_ = {
reinterpret_cast<sample::Sample*>(heap_caps_calloc(
- kCodecBufferLength, sizeof(sample::Sample), MALLOC_CAP_SPIRAM)),
+ kCodecBufferLength, sizeof(sample::Sample), MALLOC_CAP_DMA)),
kCodecBufferLength};
}