With v2 AudioUnits, you are guaranteed that the sample rate will not change after Initialize() has been called. So, one solution would be to override Initialize() in your AU, check the sample rate, and then return an error, such as kAudioUnitErr_FormatNotSupported, if the sample rate is higher than you’re comfortable with.
Another option might be to override AUBase::ValidFormat() to return false when the sample rate is above 96 kHz. Alternatively, you might be able to override ChangeStreamFormat() Keep in mind that the sample rate is part of the stream format, so any changes to sample rate must be approved as part of a stream format change. I’m not sure which of the above would be most kosher. I’m also less familiar with v3 AU design changes. You have the source code, though, so take a look around at how things are already working, and make sure that your hooks are always in the code path for every possible sample rate change and/or Initialize() scenario. I recommend against having an AudioUnit loop calling setPreferredSampleRate(). Where would you even put such a loop? Brian Willoughby p.s. What about faster processors where your AU might run just fine at 96 kHz? Are you absolutely certain that you want to lock out your plugins from users who have high end audio systems? On Aug 30, 2018, at 6:23 PM, Shea Alterio <[email protected]> wrote: > setPreferredSampleRate returns yes or no depending on if it worked or not. > Perhaps you could put it inside a loop which checks the sample rate if an > error is reported? I'm assuming this is a situation where you want the > program to respond, not the hardware sample rate of the iOS device. > > On Thu, Aug 30, 2018 at 4:53 PM AI Developer <[email protected]> > wrote: >> What is the proper way for an AudioUnit (v3) to report the fact that it does >> not support specific sample rates. >> >> We have some AudioUnits that we do not want to support above 96K. >> >> Thanks. >> Devendra. > > _______________________________________________ Do not post admin requests to the list. They will be ignored. Coreaudio-api mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/coreaudio-api/archive%40mail-archive.com This email sent to [email protected]
