[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 <kode54@gmail.com>
main
Christopher Snowhill 2022-07-11 14:39:23 -07:00
parent 9f03b72b69
commit 18824e0e18
1 changed files with 8 additions and 2 deletions

View File

@ -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));