AR: fastpath optimizations
Some optimizations in FASTPATH mode, to ensure that audio processing takes places as soon as new samples are arriving: * raise fftTask prio to 4 (above async_tcp) - to ensure that other gimmicks (MQTT, IR, alexa, live preview (ws), json API, or web UI) cannot cause delays by preempting audio. * changed the "be nice" condition in AR::loop
This commit is contained in:
@@ -25,9 +25,14 @@
|
||||
//#define SR_STATS
|
||||
|
||||
#if !defined(FFTTASK_PRIORITY)
|
||||
#if defined(WLEDMM_FASTPATH) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && defined(ARDUINO_ARCH_ESP32)
|
||||
// FASTPATH: use higher priority, to avoid that webserver (ws, json, etc) delays sample processing
|
||||
//#define FFTTASK_PRIORITY 3 // competing with async_tcp
|
||||
#define FFTTASK_PRIORITY 4 // above async_tcp
|
||||
#else
|
||||
#define FFTTASK_PRIORITY 1 // standard: looptask prio
|
||||
//#define FFTTASK_PRIORITY 2 // above looptask, below async_tcp
|
||||
//#define FFTTASK_PRIORITY 4 // above async_tcp
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3)
|
||||
@@ -499,6 +504,11 @@ void FFTcode(void * parameter)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(WLEDMM_FASTPATH) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && defined(ARDUINO_ARCH_ESP32)
|
||||
// experimental - be nice to LED update task (trying to avoid flickering) - dual core only
|
||||
if (strip.isServicing()) delay(2);
|
||||
#endif
|
||||
|
||||
// band pass filter - can reduce noise floor by a factor of 50
|
||||
// downside: frequencies below 100Hz will be ignored
|
||||
if ((useInputFilter > 0) && (useInputFilter < 99)) {
|
||||
@@ -1881,7 +1891,7 @@ class AudioReactive : public Usermod {
|
||||
return;
|
||||
}
|
||||
// We cannot wait indefinitely before processing audio data
|
||||
if (strip.isUpdating() && (millis() - lastUMRun < 2)) return; // be nice, but not too nice
|
||||
if (strip.isServicing() && (millis() - lastUMRun < 2)) return; // WLEDMM isServicing() is the critical part (be nice, but not too nice)
|
||||
|
||||
// suspend local sound processing when "real time mode" is active (E131, UDP, ADALIGHT, ARTNET)
|
||||
if ( (realtimeOverride == REALTIME_OVERRIDE_NONE) // please add other overrides here if needed
|
||||
|
||||
Reference in New Issue
Block a user