Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 232
nik4emniy Avatar asked Nov 28 '25 21:11

nik4emniy


1 Answers

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.

like image 189
hotpaw2 Avatar answered Dec 01 '25 11:12

hotpaw2