Copy SampleRate to every class or share the object


#1

Lots of classes use float sampleRate object and we also use which class we need in it.

When sampleRate is changed, we need to copy sampleRate value to our all classes that use sampleRate. 

Instead of it, if we share sampleRate pointer with the classes and when sampleRate is changed, all values automatically changed. 

What do you think for this approach? We won't have to copy sampleRate pointer to other classes when plugin initialising then ok. 

 


#2

intransparent, because the class needs to now when the sample-rate has changed. Also its possible that different classes have to use different sample rates at the same time (when parts of your signal-flow are over-sampled). And its not thread safe.


#3

You are right, there are so many reasons.