• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ExtAudioFileWrite, error -1031???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ExtAudioFileWrite, error -1031???


  • Subject: Re: ExtAudioFileWrite, error -1031???
  • From: Chris Adamson <email@hidden>
  • Date: Wed, 15 May 2013 13:46:42 -0400

Can't tell you about the -1031 (you sure you're logging it correctly?), but the root of your problem is probably that Core Audio only supports a handful of codecs in WAV files: little-endian PCM, maybe a-law and u-law, but that's about it.

Try writing your Apple Lossless to a CAF file, which is a content-agnostic format.

--Chris

On May 15, 2013, at 11:50 AM, "Edwards, Waverly" <email@hidden> wrote:

>
> I'm hoping someone can help me.
> I am attempting to write the contents of a buffer to a file using ExtAudioFileWrite.
> If I use an ASBD designed for 'WAVE' format everything works, the file is written to disk.
> If I use an ASBD designed for Apple Lossless ExtAudioFileWrite fails with error -1031.
>
> I have searched through the headers, the docs and Googled it but I cant find that error number anywhere.
> Below is a skeleton of what is going on in my program.
>
> Any ideas on what I'm doing wrong and what does error -1031 mean?
>
>
> Thanks,
>
>
> W.
>
>
> OSStatus  CreateAudioOutputFile()
> {
>  OSErr                        err;
>  UInt8                         numChannels;
>  UInt32                      numFrames;
>  ABuffList                  aBuffList;
>  CFURLRef                outPathUrl;
>  ASBDType               outFileFormat;
>  CFStringRef            suffix;
>  ExtAudioFileRef   outAudioFile;
>  AudioFileTypeID   fileType;
>
>  memset( &outFileFormat, 0, sizeof( ASBDType ) );
>
> if (  1 ==1  )
> {
>  fileType = kAudioFileM4AType;
>  suffix = CFSTR( "m4a" );
>
> // this ASBD does NOT work with ExtAudioFileWrite
>  outFileFormat.mSampleRate = 44100.0;
>  outFileFormat.mFormatID = kAudioFormatAppleLossless;
>  outFileFormat.mFormatFlags = kAppleLosslessFormatFlag_16BitSourceData;
>  outFileFormat.mFramesPerPacket = 4096;
>  outFileFormat.mChannelsPerFrame = 2;
> }
> else
> {
>
>  numChannels = kChannelStereo;
>  fileType = kAudioFileWAVEType;
>  fileSuffix =  CFSTR( "wav" );
>
> // this ASBD works with ExtAudioFileWrite
>
>  outFileFormat.mSampleRate = 44100.0;
>  outFileFormat.mFormatID = kAudioFormatLinearPCM;
>  outFileFormat.mFormatFlags = (kAudioFormatFlagsNativeEndian) | ((kAudioFormatFlagIsPacked) | (kAudioFormatFlagIsSignedInteger));
>  outFileFormat.mBytesPerPacket = 2 * numChannels;
>  outFileFormat.mFramesPerPacket = 1;
>  outFileFormat.mBytesPerFrame = 2 * numChannels;
>  outFileFormat.mChannelsPerFrame = numChannels;
>  outFileFormat.mBitsPerChannel = 16;
>  outFileFormat.mReserved = 0;
> }
>
>  outPathUrl = CreateFilePathInAppDirectory( kFinalOutFileName, suffix );
>
> // no problems here, handle errors
> err = ExtAudioFileCreateWithURL( outPathUrl, fileType, &outFileFormat, NULL, kAudioFileFlags_EraseFile, &outAudioFile );
>
>
> /* fill the buffer */
>
> // error (-1031) ??? when attempting to write apple lossless
>  err = ExtAudioFileWrite( outAudioFile, numFrames, &aBuffList );
>  return err;
> }
>
> _______________________________________________
> 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


 _______________________________________________
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

References: 
 >ExtAudioFileWrite, error -1031??? (From: "Edwards, Waverly" <email@hidden>)

  • Prev by Date: ExtAudioFileWrite, error -1031???
  • Next by Date: Re: Mixer unit and input gain ramping on iOS
  • Previous by thread: ExtAudioFileWrite, error -1031???
  • Next by thread: RE: ExtAudioFileWrite, error -1031???
  • Index(es):
    • Date
    • Thread