• 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: Get number of frames for CAF LPCM for AudioFilePlayer unit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get number of frames for CAF LPCM for AudioFilePlayer unit


  • Subject: Re: Get number of frames for CAF LPCM for AudioFilePlayer unit
  • From: Dave Fernandes <email@hidden>
  • Date: Sun, 09 Dec 2012 02:07:10 -0500

Oh, I assumed you had an ExtAudioFile from the error message. You can get and ExtAudioFile from an AudioFile using ExtAudioFileWrapAudioFileID().


On 2012-12-08, at 10:46 PM, Tim Kemp <email@hidden> wrote:

> Hi Dave,
>
> Hmm, doesn't appear to here: ExtAudioFileGetProperty expects an ExtAudioFileRef, whereas AudioFileGetProperty deals with AudioFileIDs which are different opaque types. Casting or ignoring crashes. Is there a way to convert between the types?
>
> Thanks
>
> On 8 Dec 2012, at 22:34, Dave Fernandes wrote:
>
>> This works:
>>
>> SInt64 nFrames;
>> UInt32 paramSize = sizeof(SInt64);
>> err = ExtAudioFileGetProperty(audioFile,
>> 	kExtAudioFileProperty_FileLengthFrames,
>> 	&paramSize, &nFrames);
>>
>> On 2012-12-08, at 9:30 PM, Tim Kemp <email@hidden> wrote:
>>
>>> I have some stereo audio in lpcm written to a CAF file. I want to play it back using an AUFilePlayer. I set up a region like this:
>>>
>>> // Get file length
>>> UInt64 nPackets;
>>> UInt32 nPacketsSize = sizeof(nPackets);
>>> checkError(AudioFileGetProperty(audioFile,
>>> 		kAudioFilePropertyAudioDataByteCount,
>>> 		&nPacketsSize,
>>> 	        &nPackets),
>>>          "ExtAudioFileGetProperty failed: obtaining length of playback file", false);
>>>
>>> // Setup the region
>>> ScheduledAudioFileRegion rgn;
>>> memset(&rgn.mTimeStamp, 0, sizeof(rgn.mTimeStamp));
>>> rgn.mTimeStamp.mFlags = kAudioTimeStampSampleTimeValid;
>>> rgn.mTimeStamp.mSampleTime = 0;
>>> rgn.mCompletionProc = NULL;
>>> rgn.mCompletionProcUserData = NULL;
>>> rgn.mAudioFile = audioFile;
>>> rgn.mLoopCount = 1;
>>> rgn.mStartFrame = 0;
>>> rgn.mFramesToPlay = nPackets * fileDesc.mFramesPerPacket;
>>>
>>> But it crashes during playback. I think this is because nPackets is always zero (checked right after the AudioFileGetProperty call.) Is there a better way to obtain the number of frames to play? Also, why is nPackets zero here? What should I be looking to check?
>>>
>>> Thanks
>>>
>>>
>>> _______________________________________________
>>> 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

  • Follow-Ups:
    • Re: Get number of frames for CAF LPCM for AudioFilePlayer unit
      • From: Tim Kemp <email@hidden>
References: 
 >Get number of frames for CAF LPCM for AudioFilePlayer unit (From: Tim Kemp <email@hidden>)
 >Re: Get number of frames for CAF LPCM for AudioFilePlayer unit (From: Dave Fernandes <email@hidden>)
 >Re: Get number of frames for CAF LPCM for AudioFilePlayer unit (From: Tim Kemp <email@hidden>)

  • Prev by Date: Re: Get number of frames for CAF LPCM for AudioFilePlayer unit
  • Next by Date: Re: Get number of frames for CAF LPCM for AudioFilePlayer unit
  • Previous by thread: Re: Get number of frames for CAF LPCM for AudioFilePlayer unit
  • Next by thread: Re: Get number of frames for CAF LPCM for AudioFilePlayer unit
  • Index(es):
    • Date
    • Thread