From 33e108684259420223f312efc2106fb088cf6333 Mon Sep 17 00:00:00 2001 From: Christopher Snowhill Date: Mon, 11 Jul 2022 14:39:23 -0700 Subject: [PATCH] [Visualization Controller] Minor guard check Guard check in case visualization controller is called before any data is posted to it. Signed-off-by: Christopher Snowhill --- Audio/Visualization/VisualizationController.m | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Audio/Visualization/VisualizationController.m b/Audio/Visualization/VisualizationController.m index 30bcf6c4f..3cbe61b43 100644 --- a/Audio/Visualization/VisualizationController.m +++ b/Audio/Visualization/VisualizationController.m @@ -82,10 +82,16 @@ static VisualizationController *_sharedController = nil; - (void)copyVisPCM:(float *)outPCM visFFT:(float *)outFFT latencyOffset:(double)latency { if(!outPCM && !outFFT) return; - + + if(!visAudio || !visAudioSize) { + if(outPCM) bzero(outPCM, sizeof(float) * 4096); + if(outFFT) bzero(outFFT, sizeof(float) * 2048); + return; + } + float tempPCM[4096]; if(!outPCM) outPCM = &tempPCM[0]; - + @synchronized(self) { if(!sampleRate) { bzero(outPCM, 4096 * sizeof(float));