Stop & restart UDP on pause/update.
This commit is contained in:
parent
3e494cc551
commit
753ae51dd5
@ -1172,11 +1172,16 @@ class AudioReactive : public Usermod {
|
|||||||
|
|
||||||
if (init && FFT_Task) {
|
if (init && FFT_Task) {
|
||||||
vTaskSuspend(FFT_Task); // update is about to begin, disable task to prevent crash
|
vTaskSuspend(FFT_Task); // update is about to begin, disable task to prevent crash
|
||||||
|
if (udpSyncConnected) { // close UDP sync connection (if open)
|
||||||
|
udpSyncConnected = false;
|
||||||
|
fftUdp.stop();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// update has failed or create task requested
|
// update has failed or create task requested
|
||||||
if (FFT_Task)
|
if (FFT_Task) {
|
||||||
vTaskResume(FFT_Task);
|
vTaskResume(FFT_Task);
|
||||||
else
|
connected(); // resume UDP
|
||||||
|
} else
|
||||||
// xTaskCreatePinnedToCore(
|
// xTaskCreatePinnedToCore(
|
||||||
xTaskCreate( // no need to "pin" this task to core #0
|
xTaskCreate( // no need to "pin" this task to core #0
|
||||||
FFTcode, // Function to implement the task
|
FFTcode, // Function to implement the task
|
||||||
@ -1188,7 +1193,7 @@ class AudioReactive : public Usermod {
|
|||||||
// , 0 // Core where the task should run
|
// , 0 // Core where the task should run
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
micDataReal = 0.0f; // just to ber sure
|
micDataReal = 0.0f; // just to be sure
|
||||||
if (enabled) disableSoundProcessing = false;
|
if (enabled) disableSoundProcessing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user