nik4emniy
nik4emniy

Reputation: 143

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

I've been studying the Audio Unit Hosting Guide for iOS, and then trying to play around with the sample projects provided. However, all of these projects are using the deprecated AudioUnitSampleType (which seems to be a simple typedef). It might be a rookie question, but how do I go about changing it with something? As far as my understanding goes, I should replace it with different types (SInt16 or Float) depending on the target iOS version (of course, I want to target as many as possible). So should I just write a bunch of #ifndef's or am I missing something?

Upvotes: 4

Views: 837

Answers (1)

hotpaw2
hotpaw2

Reputation: 70673

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 under that iOS version. Most likely 4-byte floats for any recent iOS version on any recent iOS device, as all the recent Apple A? processors can do arithmetic using floats as fast or faster than with SInt16 or SInt32 data.

Upvotes: 1

Related Questions