Hello, new JUCE user here


#1

Hello. I’ve just started using JUCE. I’m fairly new to C++ as well as JUCE. My background is mostly in programming microprocessors (ATMEL and STM32) with C. The main thing I’m trying to understand now is how variables get shared between different plugin instances. Where should I declare, for example, a buffer for a delay that keeps it separate from all other instances of the same plugin?


#2

variables aren’t shared between plugin instances.
declare it as a member of your AudioProcessor.

I think the SharedResourcePointer class allows sharing of data across plugin instances, though, but don’t quote me on that.


#3

Thanks. I put them in my AudioProcessor class. At first it still didn’t work and was getting feedback and interaction between instances. Once I switched my delay buffer from a float to double everything is working great. Any reason that would be? Should I stay away from floats?


#4

hmm, can’t say without showing the relevant parts of your processBlock()


#5

It is usually the other way round. The default case is using floats, and only a few hosts would query the supportsDoublePrecissionProcessing() flag and call the overloaded processBlock (AudioBuffer<double>& buffer, MidiBuffer& midi) instead.

If different plugin instances affect each others, it is a strong hint, that you were using static variables. Never do that in plugins, since you cannot control the side effects, like you observed. Unless you know exactly what you are doing (in 99% there is a better way to do it).

Your delay buffer should be declared as a simple (preferably private) member of your AudioProcessor (on the stack, not with new) and resized in prepareToPlay.