From 9fabb92d0d2993c31b4132b061f1536885448189 Mon Sep 17 00:00:00 2001 From: Steve Lascos Date: Thu, 9 Nov 2017 20:45:30 -0500 Subject: [PATCH] Further development of the external memory, correct naming issue with teh examples --- ...olib_demo.ino => 0_TGA_Pro_nolib_demo.ino} | 0 .../{TGA_Pro_demo.ino => 1_TGA_Pro_demo.ino} | 0 .../{TGA_Pro_1MEM.ino => 2_TGA_Pro_1MEM.ino} | 0 .../{TGA_Pro_2MEM.ino => 3_TGA_Pro_2MEM.ino} | 0 ..._reverb.ino => 4_TGA_Pro_delay_reverb.ino} | 0 ...o.ino => 5_TGA_Pro_ExternalDelay_demo.ino} | 0 src/BAAudioEffectDelayExternal.cpp | 61 ++++++++++++++++--- src/BAAudioEffectDelayExternal.h | 20 ++++-- 8 files changed, 67 insertions(+), 14 deletions(-) rename examples/0_TGA_Pro_TRY_FIRST/{TGA_Pro_nolib_demo.ino => 0_TGA_Pro_nolib_demo.ino} (100%) rename examples/1_TGA_Pro_demo/{TGA_Pro_demo.ino => 1_TGA_Pro_demo.ino} (100%) rename examples/2_TGA_Pro_1MEM/{TGA_Pro_1MEM.ino => 2_TGA_Pro_1MEM.ino} (100%) rename examples/3_TGA_Pro_2MEM/{TGA_Pro_2MEM.ino => 3_TGA_Pro_2MEM.ino} (100%) rename examples/4_TGA_Pro_delay_reverb/{TGA_Pro_delay_reverb.ino => 4_TGA_Pro_delay_reverb.ino} (100%) rename examples/5_TGA_Pro_ExternalDelay_demo/{TGA_Pro_ExternalDelay_demo.ino => 5_TGA_Pro_ExternalDelay_demo.ino} (100%) diff --git a/examples/0_TGA_Pro_TRY_FIRST/TGA_Pro_nolib_demo.ino b/examples/0_TGA_Pro_TRY_FIRST/0_TGA_Pro_nolib_demo.ino similarity index 100% rename from examples/0_TGA_Pro_TRY_FIRST/TGA_Pro_nolib_demo.ino rename to examples/0_TGA_Pro_TRY_FIRST/0_TGA_Pro_nolib_demo.ino diff --git a/examples/1_TGA_Pro_demo/TGA_Pro_demo.ino b/examples/1_TGA_Pro_demo/1_TGA_Pro_demo.ino similarity index 100% rename from examples/1_TGA_Pro_demo/TGA_Pro_demo.ino rename to examples/1_TGA_Pro_demo/1_TGA_Pro_demo.ino diff --git a/examples/2_TGA_Pro_1MEM/TGA_Pro_1MEM.ino b/examples/2_TGA_Pro_1MEM/2_TGA_Pro_1MEM.ino similarity index 100% rename from examples/2_TGA_Pro_1MEM/TGA_Pro_1MEM.ino rename to examples/2_TGA_Pro_1MEM/2_TGA_Pro_1MEM.ino diff --git a/examples/3_TGA_Pro_2MEM/TGA_Pro_2MEM.ino b/examples/3_TGA_Pro_2MEM/3_TGA_Pro_2MEM.ino similarity index 100% rename from examples/3_TGA_Pro_2MEM/TGA_Pro_2MEM.ino rename to examples/3_TGA_Pro_2MEM/3_TGA_Pro_2MEM.ino diff --git a/examples/4_TGA_Pro_delay_reverb/TGA_Pro_delay_reverb.ino b/examples/4_TGA_Pro_delay_reverb/4_TGA_Pro_delay_reverb.ino similarity index 100% rename from examples/4_TGA_Pro_delay_reverb/TGA_Pro_delay_reverb.ino rename to examples/4_TGA_Pro_delay_reverb/4_TGA_Pro_delay_reverb.ino diff --git a/examples/5_TGA_Pro_ExternalDelay_demo/TGA_Pro_ExternalDelay_demo.ino b/examples/5_TGA_Pro_ExternalDelay_demo/5_TGA_Pro_ExternalDelay_demo.ino similarity index 100% rename from examples/5_TGA_Pro_ExternalDelay_demo/TGA_Pro_ExternalDelay_demo.ino rename to examples/5_TGA_Pro_ExternalDelay_demo/5_TGA_Pro_ExternalDelay_demo.ino diff --git a/src/BAAudioEffectDelayExternal.cpp b/src/BAAudioEffectDelayExternal.cpp index f6adcd8..d637a78 100644 --- a/src/BAAudioEffectDelayExternal.cpp +++ b/src/BAAudioEffectDelayExternal.cpp @@ -36,17 +36,18 @@ struct MemSpiConfig { constexpr MemSpiConfig Mem0Config = {7, 8, 14, 15, 65536 }; constexpr MemSpiConfig Mem1Config = {21, 5, 20, 31, 65536 }; +unsigned BAAudioEffectDelayExternal::m_usingSPICount[2] = {0,0}; + BAAudioEffectDelayExternal::BAAudioEffectDelayExternal() : AudioStream(1, inputQueueArray) { - initialize(MemSelect::MEM0, Mem0Config.memSize); + initialize(MemSelect::MEM0); } -BAAudioEffectDelayExternal::BAAudioEffectDelayExternal(MemSelect mem, float milliseconds) +BAAudioEffectDelayExternal::BAAudioEffectDelayExternal(MemSelect mem) : AudioStream(1, inputQueueArray) { - uint32_t n = (milliseconds*(AUDIO_SAMPLE_RATE_EXACT/1000.0f))+0.5f; - initialize(mem, n); + initialize(mem); } void BAAudioEffectDelayExternal::delay(uint8_t channel, float milliseconds) { @@ -59,7 +60,7 @@ void BAAudioEffectDelayExternal::delay(uint8_t channel, float milliseconds) { n = memory_length - AUDIO_BLOCK_SAMPLES; delay_length[channel] = n; uint8_t mask = activemask; - if (activemask == 0) AudioStartUsingSPI(); + if (activemask == 0) m_startUsingSPI(m_spiChannel); activemask = mask | (1<= 8) return; uint8_t mask = activemask & ~(1<