Re: AUFilePlayer capabilities
Re: AUFilePlayer capabilities
- Subject: Re: AUFilePlayer capabilities
- From: Chris Adamson <email@hidden>
- Date: Sun, 06 Nov 2011 10:26:38 -0500
Aran--
I just ported my OSX AUFilePlayer example from the Core Audio book over to iOS and got it running pretty much right away.
Looking back (it's been a LONG time since I wrote the audio units chapter (aside: and a long time since the publisher has done anything with the stuff I've sent them [mumble, grumble]), so I'm having to try to remember how the setup works. The non-obvious part is setting up that ScheduledAudioFileRegion to tell the AUFilePlayer what to play. I probably just copied that from some Apple sample somewhere. Still, it looks like clever use of that struct could give you the behavior your want, like setting the looping, or using a completion proc to get your next file loaded up when this one completes.
Anyways, my code is at http://pastie.org/2820693
This goes in a single-view iOS app, where the view controller is the only custom code (I didn't even bother with a GUI), and you'll have to add your audio file to the bundle and change the #defines for SONG_TITLE and SONG_FILE_TYPE (unless you really like My Chemical Romance, I suppose).
Tested in 5.0 simulator and on an actual iPhone 4S. Usual caveats apply: this code is hastily-ported slop, I used ARC and did a CF cast anyways, blah blah blah. Hope this helps.
--Chris
On Nov 1, 2011, at 8:15 PM, Aran Mulholland wrote:
> I would have answered all these questions myself but am having
> problems instantiating one at the moment and getting a file loaded
> into it. (-10877 errors) I would love some sample code snippets if
> anyone has any available. Otherwise I will continue my attempts to
> turn the OSX PlayFile sample into an iOS version.
_______________________________________________
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