I’m a new user of JUCE and have just been following the tutorials to familiarize myself with the program flow , classes and functions.
I just followed the tutorial on creating a Sin-Wave generator and at the moment:
within the prepareToPlay() function; which takes sampleRate as one of its arguments. However prepareToPlay() isn’t called within Main.cpp or MainComponent.cpp - only defined. Where is this function being called?/ Where is the value of sampleRate being set/passed as an argument?
If I wanted to alter the sample rate I could just assign a value to currentSampleRate in the MainComponent() constructor, rather than in prepareToPlay(); however since this is not the global sampleRate it will only affect the values going into the buffer and possibly cause errors IF other parts of the program are using a different sample rate.
I’ve been looking through the modules as well to figure out where the global sampleRate is declared and I’m a bit lost as to how the flow of code actually takes place.
Could someone please shed some light on this?