I\'ve been trying to implement Audio Unit Graph using Apple provided code: IphoneMixerEQGraphTest. So far I have encountered two problems:
1.) I can\'t find any way
NO REPEATING FUNCTIONALITY
So far I have found a way to deal with audio stopping - although it's not pretty:
I load same audio file in AVAudioPlayer - and get from it sound file duration. Then, using
performSelector:withObject:afterDelay:
I can stop AUGraph when sound file should end playing.
PAUSE AUGRAPH FUNCTIONALITY
It turns out that implementing pause is pretty simple. While AUGraph data source is not changed - by calling
[graphController startAUGraph]; or [graphController stopAUGraph];
will only pause/resume playing.
Although this affects performSelector timer. So, to use both - pause/no-repeating possibilities, one should use NSTimer - when AUGraph paused - then timer pauses too. When AUGraph resumed - timer resumes counting, and when it reaches provided sound file duration - it stops playing.
Bottom line
By using duration value from AVAudioPlayer (or any other player which provides duration) - it is possible to implement AUGraph sound player with play/pause/stop (no-repeat/repeat)/next song/previous song/ functions + EQUALIZER.
AVAudioPlayer is a huge class, You can easily get duration from:
Float64 fileDuration = PrepareFileAU (fileAU, fileFormat, audioFile);
see ADC sample at:
http://developer.apple.com/library/mac/#samplecode/PlayFile/Introduction/Intro.html
avoiding including other frameworks.