While studying the AudioProcessorValueTreeStateTutorial I came upon the use of atomics for parameter values, like:
std::atomic<float>* gainParameter = nullptr;
So I’ve read about threading, concurrency and atomic and am beginning to understand the concept. I would just like to confirm my understanding is on the right track.
The pointers to these parameters are retrieved in the processor class using getRawParameterValue:
gainParameter = parameters.getRawParameterValue ("gain");
Later on the actual value is used in the processor block, like:
auto currentGain = *gainParameter * phase;
Is the reason using a reference to atomic instead of retrieving the value as a regular local float to make it possible for any interactive change to the parameter being reflected in realtime in the processor block? So that it’s always up to date?
Are pointers to atomic siginficantly less effective than regular float? Meaning, should I only use them when really needed.