diff --git a/src/AudioEffectAnalogDelay.cpp b/src/AudioEffectAnalogDelay.cpp index 8782923..15fd05f 100644 --- a/src/AudioEffectAnalogDelay.cpp +++ b/src/AudioEffectAnalogDelay.cpp @@ -138,7 +138,7 @@ void AudioEffectAnalogDelay::update(void) if (m_externalMemory && m_memory->getSlot()->isUseDma()) { // Using DMA unsigned loopCount = 0; - while (m_memory->getSlot()->isReadBusy()) { /*Serial.println(String("RB:") + loopCount); loopCount++; */} + while (m_memory->getSlot()->isReadBusy()) {} } // perform the wet/dry mix mix @@ -148,12 +148,12 @@ void AudioEffectAnalogDelay::update(void) release(inputAudioBlock); release(m_previousBlock); m_previousBlock = blockToOutput; + if (m_externalMemory && m_memory->getSlot()->isUseDma()) { // Using DMA - unsigned loopCount = 0; - while (m_memory->getSlot()->isWriteBusy()) { /*Serial.println(String("WB:") + loopCount); loopCount++; */} + if (m_blockToRelease) release(m_blockToRelease); + m_blockToRelease = blockToRelease; } - if (blockToRelease) release(blockToRelease); } void AudioEffectAnalogDelay::delay(float milliseconds) diff --git a/src/AudioEffectAnalogDelay.h b/src/AudioEffectAnalogDelay.h index b4220fa..a1a3fab 100644 --- a/src/AudioEffectAnalogDelay.h +++ b/src/AudioEffectAnalogDelay.h @@ -45,6 +45,7 @@ private: AudioDelay *m_memory = nullptr; size_t m_maxDelaySamples = 0; audio_block_t *m_previousBlock = nullptr; + audio_block_t *m_blockToRelease = nullptr; IirBiQuadFilterHQ *m_iir = nullptr; // Controls diff --git a/src/BASpiMemory.cpp b/src/BASpiMemory.cpp index b091f73..f42d47a 100644 --- a/src/BASpiMemory.cpp +++ b/src/BASpiMemory.cpp @@ -372,12 +372,12 @@ void BASpiMemoryDMA::write(size_t address, uint8_t *src, size_t numBytes) size_t nextAddress = address; while (bytesRemaining > 0) { m_txXferCount = min(bytesRemaining, MAX_DMA_XFER_SIZE); - while ( m_txTransfer[1].busy()) {Serial.println("W1");} // wait until not busy + while ( m_txTransfer[1].busy()) {} // wait until not busy m_setSpiCmdAddr(SPI_WRITE_CMD, nextAddress, m_txCommandBuffer); m_txTransfer[1] = DmaSpi::Transfer(m_txCommandBuffer, CMD_ADDRESS_SIZE, nullptr, 0, m_cs, TransferType::NO_END_CS); m_spiDma->registerTransfer(m_txTransfer[1]); - while ( m_txTransfer[0].busy()) { Serial.println("W2");} // wait until not busy + while ( m_txTransfer[0].busy()) {} // wait until not busy m_txTransfer[0] = DmaSpi::Transfer(srcPtr, m_txXferCount, nullptr, 0, m_cs, TransferType::NO_START_CS); m_spiDma->registerTransfer(m_txTransfer[0]); bytesRemaining -= m_txXferCount; @@ -426,12 +426,12 @@ void BASpiMemoryDMA::read(size_t address, uint8_t *dest, size_t numBytes) while (bytesRemaining > 0) { m_setSpiCmdAddr(SPI_READ_CMD, nextAddress, m_rxCommandBuffer); - while ( m_rxTransfer[1].busy()) { Serial.println("R1"); } + while ( m_rxTransfer[1].busy()) {} m_rxTransfer[1] = DmaSpi::Transfer(m_rxCommandBuffer, CMD_ADDRESS_SIZE, nullptr, 0, m_cs, TransferType::NO_END_CS); m_spiDma->registerTransfer(m_rxTransfer[1]); m_rxXferCount = min(bytesRemaining, MAX_DMA_XFER_SIZE); - while ( m_rxTransfer[0].busy()) {Serial.println("R2");} + while ( m_rxTransfer[0].busy()) {} m_rxTransfer[0] = DmaSpi::Transfer(nullptr, m_rxXferCount, destPtr, 0, m_cs, TransferType::NO_START_CS); m_spiDma->registerTransfer(m_rxTransfer[0]);