I’m still fairly new to JUCE and I have some basic questions about the operation of the process block. All answers are greatly appreciated!
So – I know that the processBlock() needs to run as quickly as possible, so we must avoid doing any memory reallocation in this function. But what about subroutines that are called within the flow of processBlock()? If I have a helper function that needs to dynamically resize an array on the fly, and I want to call this function within processBlock(), is that a no-no? Does everything called/declared within the body of processBlock() run on a single thread? (sorry if this is a stupid question)
Would it be less problematic to instead declare a new float[desiredSize] within the subroutine and then delete it every time, or does declaring a new array also run into the memory allocation problem?
Specifically, I’m working on implementing a pitch shifting algorithm, and for my resynthesis phase’s OLA step I need to calculate and store the sample values of a Hanning window function whose length is proportional to the fundamental frequency (I’ve already dealt with detecting the fundamental frequency w/ the YIN algorithm). So theoretically, I could either have a global float array that gets resized & filled with values for each signal vector, or I could create a new array with each call of processblock() and delete it before the end of processBlock().
If anyone’s curious and wants to sweep an eye over my code for glaring bugs, it’s on GitHub here. (my plugin doesn’t have a GUI yet, I’m just working on my implementations of all the back-end code for now)