summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tangara/audio/audio_decoder.cpp2
-rw-r--r--src/tangara/audio/processor.cpp4
-rw-r--r--src/tasks/tasks.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/src/tangara/audio/audio_decoder.cpp b/src/tangara/audio/audio_decoder.cpp
index fca7e6da..2306e994 100644
--- a/src/tangara/audio/audio_decoder.cpp
+++ b/src/tangara/audio/audio_decoder.cpp
@@ -70,7 +70,7 @@ Decoder::Decoder(std::shared_ptr<SampleProcessor> processor)
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_DMA)),
+ kCodecBufferLength, sizeof(sample::Sample), MALLOC_CAP_SPIRAM)),
kCodecBufferLength};
}
diff --git a/src/tangara/audio/processor.cpp b/src/tangara/audio/processor.cpp
index 2fa7f78e..3126f050 100644
--- a/src/tangara/audio/processor.cpp
+++ b/src/tangara/audio/processor.cpp
@@ -52,7 +52,7 @@ SampleProcessor::SampleProcessor(drivers::PcmBuffer& sink)
: commands_(xQueueCreate(2, sizeof(Args))),
source_(xStreamBufferCreateWithCaps(kSourceBufferLength + 1,
sizeof(sample::Sample),
- MALLOC_CAP_DMA)),
+ MALLOC_CAP_SPIRAM)),
sink_(sink),
unprocessed_samples_(0) {
tasks::StartPersistent<tasks::Type::kAudioConverter>([&]() { Main(); });
@@ -354,7 +354,7 @@ Buffer::Buffer()
: storage_(reinterpret_cast<sample::Sample*>(
heap_caps_calloc(kSampleBufferLength,
sizeof(sample::Sample),
- MALLOC_CAP_DMA))),
+ MALLOC_CAP_SPIRAM))),
buffer_(storage_, kSampleBufferLength),
samples_in_buffer_() {}
diff --git a/src/tasks/tasks.cpp b/src/tasks/tasks.cpp
index f0b567f2..c85b492b 100644
--- a/src/tasks/tasks.cpp
+++ b/src/tasks/tasks.cpp
@@ -40,8 +40,8 @@ auto AllocateStack() -> std::span<StackType_t>;
template <>
auto AllocateStack<Type::kAudioDecoder>() -> std::span<StackType_t> {
constexpr std::size_t size = 20 * 1024;
- static StackType_t sStack[size];
- return {sStack, size};
+ return {static_cast<StackType_t*>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM)),
+ size};
}
// LVGL requires only a relatively small stack. Lua's stack is allocated
// separately.
@@ -55,8 +55,8 @@ template <>
// PCM conversion and resampling uses a very small amount of stack.
auto AllocateStack<Type::kAudioConverter>() -> std::span<StackType_t> {
constexpr std::size_t size = 4 * 1024;
- static StackType_t sStack[size];
- return {sStack, size};
+ return {static_cast<StackType_t*>(heap_caps_malloc(size, MALLOC_CAP_SPIRAM)),
+ size};
}
// Background workers receive huge stacks in PSRAM. This is mostly to faciliate
// use of LevelDB from any bg worker; Leveldb is designed for non-embedded use