diff --git a/MicroDexed.ino b/MicroDexed.ino index a5ade38..7acf98e 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -38,15 +38,13 @@ using namespace TeensyTimerTool; #include "effect_modulated_delay.h" #include "effect_stereo_mono.h" #include "effect_mono_stereo.h" -#ifdef USE_PLATEREVERB +#if defined(USE_PLATEREVERB) #include "effect_platervbstereo.h" -#else -#ifndef TEENSY_4 +#elif defined(USE_FREEVERB_SIMD) #include "effect_freeverb_simd.h" #else #include "effect_freeverbf.h" #endif -#endif #include "template_mixer.hpp" #include "UI.hpp" #if NUM_DRUMS > 0 @@ -78,16 +76,14 @@ AudioAnalyzePeak microdexed_peak; #if defined(USE_FX) AudioMixer<4> reverb_mixer_r; AudioMixer<4> reverb_mixer_l; -#ifdef USE_PLATEREVERB +#if defined(USE_PLATEREVERB) AudioEffectPlateReverb reverb; -#else -#ifndef TEENSY_4 +#elif defined(USE_FREEVERB_SIMD) AudioEffectFreeverbSIMDStereo freeverb; #else AudioEffectFreeverbStereoFloat freeverb; #endif #endif -#endif AudioMixer<4> master_mixer_r; AudioMixer<4> master_mixer_l; AudioAmplifier volume_r; @@ -882,7 +878,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) #if NUM_DRUMS > 0 // Check for Drum - if (inChannel == drum_midi_channel) + if (inChannel == drum_midi_channel || drum_midi_channel == MIDI_CHANNEL_OMNI) { if (drum_counter >= NUM_DRUMS) drum_counter = 0; @@ -895,6 +891,7 @@ void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity) Serial.print(F("]: ")); Serial.println(note_name); #endif + for (uint8_t d = 0; d < NUM_DRUMSET_CONFIG; d++) { if (inNumber == drum_config[d].midinote) @@ -2560,6 +2557,9 @@ uint8_t check_sd_cards(void) volumesize = volume.blocksPerCluster() * volume.clusterCount() / 2097152; + if (volumesize == 0) + ret = -1; + #ifdef DEBUG Serial.print(F("Volume type is FAT")); Serial.println(volume.fatType(), DEC); diff --git a/UI.hpp b/UI.hpp index 72feacd..6d6b34a 100644 --- a/UI.hpp +++ b/UI.hpp @@ -32,15 +32,13 @@ #include "synth_dexed.h" #include "effect_modulated_delay.h" #include "effect_stereo_mono.h" -#ifdef USE_PLATEREVERB +#if defined(USE_PLATEREVERB) #include "effect_platervbstereo.h" -#else -#ifndef TEENSY_4 +#elif defined(USE_FREEVERB_SIMD) #include "effect_freeverb_simd.h" #else #include "effect_freeverbf.h" #endif -#endif #include "template_mixer.hpp" #include "drumset.h" @@ -137,22 +135,19 @@ extern AudioEffectDelay* delay_fx[NUM_DEXED]; extern AudioMixer<4>* delay_mixer[NUM_DEXED]; #endif extern AudioEffectMonoStereo* mono2stereo[NUM_DEXED]; - extern AudioMixer<4> microdexed_peak_mixer; extern AudioAnalyzePeak microdexed_peak; #if defined(USE_FX) extern AudioMixer<4> reverb_mixer_r; extern AudioMixer<4> reverb_mixer_l; -#ifdef USE_PLATEREVERB +#if defined(USE_PLATEREVERB) extern AudioEffectPlateReverb reverb; -#else -#ifndef TEENSY_4 +#elif defined(USE_FREEVERB_SIMD) extern AudioEffectFreeverbSIMDStereo freeverb; #else extern AudioEffectFreeverbStereoFloat freeverb; #endif #endif -#endif extern AudioMixer<4> master_mixer_r; extern AudioMixer<4> master_mixer_l; extern AudioEffectStereoMono stereo2mono; diff --git a/config.h b/config.h index 2e42506..b9ef311 100644 --- a/config.h +++ b/config.h @@ -150,6 +150,9 @@ #endif #if defined(TEENSY4) #define USE_PLATEREVERB 1 +#else +//#define USE_FREEVERB_SIMD +#define USE_FREEVERB_FP #endif // DELAYTIME @@ -349,7 +352,7 @@ // Teensy-3.6 settings #if defined(TEENSY3_6) # if defined(USE_FX) -# warning >>> With enabled FX a maximum of 13 voices is possible (due to RAM and CPU limitations) +# warning >>> With enabled FX a maximum of 12 voices is possible (due to RAM and CPU limitations) # define MAX_NOTES 12 # if F_CPU > 180000000 # error >>> Enabled FX with clockrate more than 180MHz is not useful due to RAM limitations. @@ -362,13 +365,13 @@ # warning >>> Maximum of 20 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. # define MAX_NOTES 20 # elif F_CPU == 216000000 -# warning >>> Maximum of 20 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. +# warning >>> Maximum of 18 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. # define MAX_NOTES 18 # elif F_CPU == 192000000 -# warning >>> Maximum of 18 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. +# warning >>> Maximum of 16 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. # define MAX_NOTES 16 # elif F_CPU == 180000000 -# warning >>> Maximum of 16 voices. You should consider to use 256MHz overclocking to get a maximum of 24 voices. +# warning >>> Maximum of 14 voices. You should consider to use 256MHz overclocking to get a maximum of 22 voices. # define MAX_NOTES 14 # else # error >>> CPU Clock below 180MHz is not supported diff --git a/effect_freeverb_simd.cpp b/effect_freeverb_simd.cpp index 3371a95..a0ecafa 100644 --- a/effect_freeverb_simd.cpp +++ b/effect_freeverb_simd.cpp @@ -161,6 +161,17 @@ void AudioEffectFreeverbSIMD::update() sum = 0; +/* +asm volatile ( + "QADD %[SUM], %[C1], %[C2]\n" + "QADD %[SUM], %[C3], %[C4]\n" + "QADD %[SUM], %[C5], %[C6]\n" + "QADD %[SUM], %[C7], %[C8]\n" + :[SUM]"=r"(sum) + :[C1]"r"((int32_t)comb1buf[comb1index]),[C2]"r"((int32_t)comb2buf[comb2index]),[C3]"r"((int32_t)comb3buf[comb3index]),[C4]"r"((int32_t)comb4buf[comb4index]),[C5]"r"((int32_t)comb5buf[comb5index]),[C6]"r"((int32_t)comb6buf[comb6index]),[C7]"r"((int32_t)comb7buf[comb7index]),[C8]"r"((int32_t)comb8buf[comb8index]) + : + ); +*/ asm volatile ( "QADD %[SUM], %[C1], %[C2]\n" "QADD %[SUM], %[C3], %[SUM]\n" @@ -566,9 +577,6 @@ void AudioEffectFreeverbSIMD::update() if (++comb6index >= sizeof(comb6buf) / sizeof(int16_t)) comb6index = 0; if (++comb7index >= sizeof(comb7buf) / sizeof(int16_t)) comb7index = 0; if (++comb8index >= sizeof(comb8buf) / sizeof(int16_t)) comb8index = 0; - - - } transmit(outblock); release(outblock);