From 2bf1c644ef19a38de1b140b939b7900f37587103 Mon Sep 17 00:00:00 2001 From: Dirk Niggemann Date: Sun, 27 Oct 2019 15:09:27 +0000 Subject: [PATCH] Try to decrease max_notes if CPU limit reached Experimental --- source_microdexed.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source_microdexed.h b/source_microdexed.h index f0cb8f2..ffde2e2 100644 --- a/source_microdexed.h +++ b/source_microdexed.h @@ -29,6 +29,13 @@ class AudioSourceMicroDexed : public AudioStream, public Dexed { getSamples(AUDIO_BLOCK_SAMPLES, lblock->data); if (render_time > audio_block_time_us) // everything greater 2.9ms is a buffer underrun! xrun++; + if (render_time > audio_block_time_us - (audio_block_time_us / 10)) { + Serial.println("At CPU Limit"); + uint8_t nnotes = getNumNotesPlaying(); + //setMaxNotes(nnotes); + max_notes = nnotes; + } + if (render_time > render_time_max) render_time_max = render_time;