Audio Unit sample rate


#1

Hi,

Quick question, the private member of AudioFilterBase sampleRate for an audio unit is not being set at present. While you do get the current sample rate passed into prepareToPlay, there is no setSampleRate function in AudioFilterBase that you can use, only getSampleRate. Am I missing something or should I just create my own sampleRate member in any AudioFilterBase derived class and then set my own sampleRate class member when prepareToPlay is called? Seems funny as it is set in the VST wrapper ok.

Also noticed that there is a sampleRate somewhere outside the name space that you can set in prepareToPlay so be careful out there!

Thanks in advance.


#2

The plugin can’t choose its sample rate, it just gets told what to use by the host. And you can’t always guarantee to know the rate before the prepareToPlay method is called, so should avoid using it until then.


#3