• 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
AudioFileOpenWithCallbacks...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AudioFileOpenWithCallbacks...


  • Subject: AudioFileOpenWithCallbacks...
  • From: Gavin Burke <email@hidden>
  • Date: Fri, 10 Jul 2009 12:45:22 +0100

Currently I am struggling with opening an audio file. In a previous version of my software I used an iostream, timers, fread and my own file opening function for parsing the wav file header, getting the data etc. This was fine as I was only opening a fixed set of files. 

Now that I want to open multiple file types I am trying to switch to AudioFile.h functions.

Looking at the documentation, AudioFileOpenWithCallbacks seems to be what I need, AudioFileOpenWithCallbacks providing for async file load so I don't block everything waiting for a large file to open.

Currently this is what I am doing below. AudioFile_ReadProc only gets called once, I thought the purpose of OpenWithCallbacks is that it keeps being called until you have read 
the entire file? There is nothing really on this process anywhere so some advice/explanation would help.


// AudioFile_ReadProc callback
OSStatus MyAudioFile_ReadProc (void *inClientData, SInt64 inPosition, UInt32 requestCount, void *buffer,UInt32 *actualCount){

AudioFileReader *audioFileReader = (AudioFileReader *) inClientData;

OSErr err = AudioFileReadBytes(audioFileReader.afid, false,audioFileReader.numAudioDataBytesRead, &requestCount, audioFileReader.audioData);
if(err == noErr)
{
printf("AudioFileReadBytes Ok!");
audioFileReader.numAudioDataBytesRead+=requestCount;
*actualCount = requestCount;
}


}



-(void)testFileOpen(){

...

AudioFileOpenURL(inFileURL, kAudioFileReadPermission, 0, &afid);

...

AudioFileOpenWithCallbacks(self,
   MyAudioFile_ReadProc,
   MyAudioFile_WriteProc,
   MyAudioFile_GetSizeProc,
   MyAudioFile_SetSizeProc,
   nil,
   &afid
           );
}
 _______________________________________________
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

  • Prev by Date: how to access HAL buffer timestamps when using AUHAL?
  • Next by Date: Re: AudioUnits: Threading of property fetching and Render-proc
  • Previous by thread: Re: how to access HAL buffer timestamps when using AUHAL?
  • Next by thread: Re: AudioFileOpenWithCallbacks...
  • Index(es):
    • Date
    • Thread