OK ttg, I have some thoughts in subject.
Ok, but even if I calculate
AttackInSamples in the processor block I still need to be able to change
AttackInSeconds outside of audio thread (for example by some
Slider). That’s why to ensure thread safety my
But if I calculate them outside of audio thread I still assign calculations to
AttackInSamples which is also
std::atomic<float>. So untill I have sample rate propery defined my audio thread is safty - no matter if I calculate it inside or outside the
Am I right? Please correct me if I am wrong.
Other thing is efficiency.
I calculate my
AttackInSamples= exp( 0.435f /( AttackInSeconds * sampleRate * 0.001f) );
And I’ve made some small tests with calculation it in
proccessBlock. You are right it’s not “that” expensive. But if I have a lot of other calculations I try to be as fast as possible. So I still claim to calculate
AttackInSamples outside of
That’s why I wonder if is it OK to call my saved parameters in
prepareToPlay() where I have always sample rate defined. Is it good idea?