// 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;