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

Re: PlayFile


  • Subject: Re: PlayFile
  • From: Michael Hanna <email@hidden>
  • Date: Tue, 13 Dec 2005 08:40:51 -0800

Well, thanks. I realize now that Bill was saying this to me all along, but I simply didn't clue in. Sorry Bill.
Michael



On 12-Dec-05, at 11:36 PM, Andrew Pouliot wrote:

On Dec 12, 2005, at 11:11 PM, Michael Hanna wrote:

-(void)doPlayFile
{
…
	// start playing
	XThrowIfError (AUGraphStart (theGraph), "AUGraphStart");

This is where you should break off the method. The method must end now so that audio processing can continue in the background without blocking the run loop.


Remove the usleep code:

	// sleep until the file is finished
	usleep ((int)fileDuration * 1000 * 1000);

If you want to kill your AUGraph at the end of playback, then set up a timer to fire with (I presume) fileDuration seconds in the future that triggers a method that does the rest of the code (cleanup operation). The creation of the timer would go at the end of doPlayFile


You could also do the cleanup when the controller is deallocated.

Or, you could make a stop button that called it.


// lets clean up
XThrowIfError (AUGraphStop (theGraph), "AUGraphStop");
XThrowIfError (AUGraphUninitialize (theGraph), "AUGraphUninitialize");
XThrowIfError (AudioFileClose (audioFile), "AudioFileClose");
XThrowIfError (AUGraphClose (theGraph), "AUGraphClose");

// return 0;


}

I haven't scrutinized the audio code itself, but this should make it work if the code was valid before.


I hope that helps!

—Andrew Pouliot

_______________________________________________ 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: 
 >MTCoreAudio (From: Michael Hanna <email@hidden>)
 >Re: MTCoreAudio (From: William Stewart <email@hidden>)
 >PlayFile [was Re: MTCoreAudio] (From: Michael Hanna <email@hidden>)
 >Re: PlayFile [was Re: MTCoreAudio] (From: William Stewart <email@hidden>)
 >Re: PlayFile (From: Michael Hanna <email@hidden>)
 >Re: PlayFile (From: William Stewart <email@hidden>)
 >Re: PlayFile (From: Michael Hanna <email@hidden>)
 >Re: PlayFile (From: Andrew Pouliot <email@hidden>)

  • Prev by Date: How to play a waveform?
  • Next by Date: kAudioUnitProperty_ClassInfo endianness
  • Previous by thread: Re: PlayFile
  • Next by thread: Callback [was PlayFile]
  • Index(es):
    • Date
    • Thread