How to find/change buffer size and sample rate?

Hi, I’ve been looking into the audioAppComponent class and would like to know how prepareToPlay() is finding its samplesPerBlockExpected and sampleRate. I have looked deeper and see commentary stating this is dependent on the hardware, and that this can vary, however coming from Maximilian I’m just trying to find some comfort in the fact I didn’t need to declare these myself.

Also, if I wanted to potentially change these, would this be done within prepareToPlay()?

Thanks for your help.

The prepareToPlay is a callback, you never call this yourself.
The AudioAppComponent has an AudioSourcePlayer, which will play the AudioAppComponent, which is (i.e. inherits) an AudioSource.
When you call AudioAppComponent::setAudioChannels(), the devicemanager initialises the AudioDevice (from the optional xml settings). The AudioSourcePlayer will then call your callback prepareToPlay with the actual chosen settings.


Thanks I wasn’t aware that you could use xml. Really helpful.