How to replace deprecated AudioUnitSampleType on iOS (Audio Units)?

I am researching the Audio Unit Hosting iOS Guide and then trying to play around with the sample projects provided. However, all of these projects use the deprecated AudioUnitSampleType (which seems to be a simple typedef). This might be a newbie question, but how can I change anything? As I understand it, I have to replace it with different types (SInt16 or Float) depending on the target iOS version (of course, I want to target as much as possible). So should I just write a bunch of #ifndef or am I missing something?

+3


source to share


1 answer


Instead of guessing / ifdef 'ing, you should get the kAudioUnitProperty_StreamFormat property for each audio unit and use the native format for that audio unit in that iOS version. Most likely 4 byte floats for any latest iOS on any new iOS device like all the latest Apple A's? processors can perform arithmetic using floats as fast or faster than SInt16 or SInt32 data.



+1


source







All Articles