e.g. to make a 16-bit stereo AIFF:
AudioStreamBasicDescription filefmt;
filefmt.mSampleRate = auRenderSampleRate;
// you probably don't want to guess on the sample rate; get the AU's rate
filefmt.mFormatID = kAudioFormatLinearPCM;
filefmt.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
filefmt.mBytesPerPacket = filefmt.mBytesPerFrame = 4;
filefmt.mFramesPerPacket = 1;
filefmt.mChannelsPerFrame = 2;
filefmt.mBitsPerChannel = 16;
On Apr 10, 2009, at 14:40 , Doug Wyatt wrote:
On Apr 10, 2009, at 14:34 , Jeff Evans wrote:
Thanks, Doug - though as you say, AudioUnitGetProperty is used to fill in the ASBD based on the characteristics of the synth, which is the DLS synth. Then that ASBD is applied to the external file using ExtAudioFileSetProperty. The sample code doesn't include any other way of setting the output format, aside from specifying the type (WAVE, AIFF, CAF, etc.). I don't see why this sample code would work, given what you say below. Actually I have no proof that the sample code does work, I suppose.
In any event I've tried specifying CAF file output too, but ExtAudioFileCreateNew still fails with the unsupported format error with the ASBD filled out as per the sample code. Is the sample code missing some way to set up a separate ASBD for the output file?
Sorry, I have no idea of what sample code you are looking at or where to find it. I do, however, have a copy of CAAudioUnitOutputCapturer.h in front of me. What is the audio data format being passed to the constructor? If you get an error even when specifying CAF, then most likely the data format is not correctly filled out.
Doug
--
If this email is spam, report it here:
http://www.onlymyemail.com/view/?action="">