diff --git a/MicroDexed.ino b/MicroDexed.ino index 843c251..1c45004 100644 --- a/MicroDexed.ino +++ b/MicroDexed.ino @@ -961,7 +961,6 @@ void handleSystemReset(void) /****************************************************************************** MIDI HELPER ******************************************************************************/ - bool checkMidiChannel(byte inChannel) { // check for MIDI channel diff --git a/config.h b/config.h index b089fe7..d7b3fbb 100644 --- a/config.h +++ b/config.h @@ -219,7 +219,6 @@ #endif #if defined(__IMXRT1062__) //Teensy-4.0 -#undef MIDI_DEVICE_USB_HOST #undef MIDI_DEVICE_USB #define MAX_NOTES 16 #endif diff --git a/source_microdexed.h b/source_microdexed.h index bcd6b81..f0cb8f2 100644 --- a/source_microdexed.h +++ b/source_microdexed.h @@ -12,10 +12,20 @@ class AudioSourceMicroDexed : public AudioStream, public Dexed { AudioSourceMicroDexed(int sample_rate) : AudioStream(0, NULL), Dexed(sample_rate) { }; void update(void) { + if (in_update) { + xrun++; + return; + } + else in_update = true; + elapsedMicros render_time; audio_block_t *lblock; lblock = allocate(); - if (!lblock) return; + if (!lblock) { + in_update = false; + return; + + } getSamples(AUDIO_BLOCK_SAMPLES, lblock->data); if (render_time > audio_block_time_us) // everything greater 2.9ms is a buffer underrun! xrun++; @@ -24,6 +34,8 @@ class AudioSourceMicroDexed : public AudioStream, public Dexed { transmit(lblock, 0); release(lblock); + in_update = false; }; private: + volatile bool in_update = false; };