/* MicroDexed MicroDexed is a port of the Dexed sound engine Dexed ist heavily based on https://github.com/google/music-synthesizer-for-android This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA effect_delay_ext8 is a special delay class for APS6404L-3SQR based memory chips on a Teensy-4.1. The cod is a combination of the PJRC delay_ext class and suggestions from https://forum.pjrc.com/threads/29276-Limits-of-delay-effect-in-audio-library/page5?highlight=APS6404L-3SQR */ #ifndef effect_delay_ext8_h_ #define effect_delay_ext8_h_ #include "Arduino.h" #include "AudioStream.h" #include "spi_interrupt.h" class AudioEffectDelayExternal8 : public AudioStream { public: AudioEffectDelayExternal8() : AudioStream(1, inputQueueArray) { initialize(4194304); } AudioEffectDelayExternal8(float milliseconds=1e6) : AudioStream(1, inputQueueArray) { uint32_t n = (milliseconds*(AUDIO_SAMPLE_RATE_EXACT/1000.0f))+0.5f; initialize(n); } void delay(uint8_t channel, float milliseconds) { if (channel >= 8) return; if (milliseconds < 0.0f) milliseconds = 0.0f; uint32_t n = (milliseconds*(AUDIO_SAMPLE_RATE_EXACT/1000.0f))+0.5f; n += AUDIO_BLOCK_SAMPLES; if (n > memory_length - AUDIO_BLOCK_SAMPLES) n = memory_length - AUDIO_BLOCK_SAMPLES; delay_length[channel] = n; uint8_t mask = activemask; if (activemask == 0) AudioStartUsingSPI(); activemask = mask | (1<= 8) return; uint8_t mask = activemask & ~(1<