From 912f9c0757a911b10478a2b498d551dc1fe6e7e4 Mon Sep 17 00:00:00 2001 From: jacqueline Date: Thu, 19 Oct 2023 13:01:28 +1100 Subject: Free the i2s dma channel when it's not in use It turns out this is why bluetooth playback keeps running out of memory /facepalm --- src/audio/audio_fsm.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/audio/audio_fsm.cpp') diff --git a/src/audio/audio_fsm.cpp b/src/audio/audio_fsm.cpp index 5020a6ef..7480934b 100644 --- a/src/audio/audio_fsm.cpp +++ b/src/audio/audio_fsm.cpp @@ -98,13 +98,6 @@ namespace states { void Uninitialised::react(const system_fsm::BootComplete& ev) { sServices = ev.services; - auto dac = drivers::I2SDac::create(sServices->gpios()); - if (!dac) { - events::System().Dispatch(system_fsm::FatalError{}); - events::Ui().Dispatch(system_fsm::FatalError{}); - return; - } - constexpr size_t kDrainBufferSize = drivers::kI2SBufferLengthFrames * sizeof(sample::Sample) * 2 * 8; ESP_LOGI(kTag, "allocating drain buffer, size %u KiB", @@ -113,8 +106,7 @@ void Uninitialised::react(const system_fsm::BootComplete& ev) { kDrainBufferSize, sizeof(sample::Sample) * 2, MALLOC_CAP_DMA); sFileSource.reset(new FatfsAudioInput(sServices->tag_parser())); - sI2SOutput.reset(new I2SAudioOutput(stream, sServices->gpios(), - std::unique_ptr{*dac})); + sI2SOutput.reset(new I2SAudioOutput(stream, sServices->gpios())); sBtOutput.reset(new BluetoothAudioOutput(stream, sServices->bluetooth())); auto& nvs = sServices->nvs(); -- cgit v1.2.3