Some iPhone AudioUnit question
Some iPhone AudioUnit question
I am working on a little iphone project, and my code behaves fine in the simulator (with the caveat that sound only comes over my USB headphones, and yes, i tried all kind of "fixes" that i found on the net - funny thing is that it works fine on my laptop, but not on the workstation...headphones are fine for now).
But, when i install the app on the device, the sound is completely distorted. Now the caf files i am using worked fine when played in different scenarios (like using OpenAL etc) directly on the device. So i assume i am doing something wrong when assembling my graph. iOS latest, iphone 4 device. Did not try on another device yet.
I have mono, LPCM 16 bit files, and looking at what i get from AudioFileGetProperty, i thought i set up the description like this:
audioDescription.mSampleRate = AUDIO_BIT_RATE; audioDescription.mFormatID = kAudioFormatLinearPCM; audioDescription.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked; audioDescription.mFramesPerPacket = 1; audioDescription.mChannelsPerFrame = 1; audioDescription.mBitsPerChannel = 16; audioDescription.mBytesPerPacket = 2; audioDescription.mBytesPerFrame = 2;
.. .when i get the samples in the callback, i get UInt16 bits, and fill the buffer with it. I am combining 2 mono sources using a Mixer.
As said this sounds great in the simulator, but completely garbled in the device. I assume i am overlooking a "DOoooooh" moment (like UInt16 means something good on OSX, but is the wrong datatype to use on the device...), but I am tired, and quick searches did not find the answer.
I don't see anything special in the console, and other tools are not complaining either (build & analyze etc). But, running on the device creates the feeling that "hey, that thing is going to die really soon if i don't stop the app".
As this whole AudioUnit area is new to me (not a sound programmer by trade does not help, but it's exciting to learn), i thought maybe you guys can point me to a common pitfalls link?
Tia
Frank Mantek |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden