Hi all.
I'm mixing multiple audio streams in an iPhone / iTouch app and clamping the result to 16 bits. Everything works fine right now, but since I'm generating intermediate results in 16.16 I could trivially convert to 8.24 and use iPhone's native resolution and save some CPU on the clamping code's over/underflow testing. What changes do I need to make to the AudioStreamBasicDescription and AUDIOFORMATFLAGS to enable this? Also, once 8.24 is enabled, will the same code run on Mac OS X, or is the 8.24 audio format not supported on the desktop?
Here's what I'm doing right now -
#define AUDIOFORMATFLAGS kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked
// Describe format AudioStreamBasicDescription audioFormat; audioFormat.mSampleRate = 22050; audioFormat.mFormatID = kAudioFormatLinearPCM; audioFormat.mFormatFlags = AUDIOFORMATFLAGS; audioFormat.mFramesPerPacket = 1; audioFormat.mChannelsPerFrame = 2; audioFormat.mBitsPerChannel = 16; audioFormat.mBytesPerPacket = 4; audioFormat.mBytesPerFrame = 4;
// Apply format status = AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, kOutputBus, &audioFormat, sizeof(audioFormat));
I've tried all sorts of perms and combs and just get no sound, so any pointers will help. |