>I believe you have to copy the iPod >library file into your own app >document
>dir to have it work with the aufileplayer
> Is it possible to use two sources in AUGraph on iOS: .caf and an iPod
> library file? I've tried to use kAudioUnitSubType_MultiChannelMixer,
> kAudioUnitSubType_AUConverter, setting stream descriptions. I've also tried
> to play only one iPod library file through kAudioUnitSubType_AUConverter.
> The output is only audio from the .caf file in first case and silent in the
> second case. Although seems I don't get errors while initialising
> AudioFileID with an iPod library file, setting up the corresponding
> kAudioUnitSubType_AudioFilePlayer and scheduling the file for playback.
> What am I doing wrong?
Previous to iOS 7, ExtAudioFile did not work with iPod media URLs (AudioFile did if I recall correctly)...so copying of the original source was required or AVAssetReader was employed in an attempt to perform real-time playback leading to all sorts of other issues. Important safety tip - Do not use AVAssetReader in a real-time capacity.
With iOS 7 you may now use ExtAudioFile for media library URLs, get back lpcm and do whatever you need to do. There is no requirement for another AUConverter at all (this AU will not decompress audio for you anyway), or the need to copy it into your directory before working with the data (although you may certainly keep doing that if you wish).
Regarding the AUAudioFilePlayer, this AU internally makes use of ExtAudioFile and therefore will also handle decompression for you if for example you are attempting to play an iPod library .m4a asset -- I see no reason why you couldn't use the AUAudioFilePlayer on iOS to play an iPod library URL (assuming of course the item wasn't protected, but this is a rarer condition these days) -- unless of course you're attempting to do this on iOS 6 or before where as mentioned ExtAudioFile didn't work with iPod media URLs.
Since I personally haven't use the AUAudioFilePlayer with an iPod URL, I would recommend a simple test case where all you're doing is using the AUAudioFilePlayer connected to the RIO -- if that works fine with a file in your app bundle (for example AAC encoded .m4a) but does not work with the iPod URL (lets say the same file in your media library this time) on iOS 7, please file a bug so we can figure out what's up.
Needless to say if the above works as expected, adding a mixer into the graph should work as well - this should give you a place to start.
edward
|