• 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
ExtAudioFileWrite, error -1031???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ExtAudioFileWrite, error -1031???


  • Subject: ExtAudioFileWrite, error -1031???
  • From: "Edwards, Waverly" <email@hidden>
  • Date: Wed, 15 May 2013 10:50:34 -0500
  • Acceptlanguage: en-US
  • Thread-topic: ExtAudioFileWrite, error -1031???

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

  • Follow-Ups:
    • Re: ExtAudioFileWrite, error -1031???
      • From: Chris Adamson <email@hidden>
  • Prev by Date: Mixer unit and input gain ramping on iOS
  • Next by Date: Re: ExtAudioFileWrite, error -1031???
  • Previous by thread: Re: Mixer unit and input gain ramping on iOS
  • Next by thread: Re: ExtAudioFileWrite, error -1031???
  • Index(es):
    • Date
    • Thread