Can I do AudioServicesPlaySystemSound Looping with scheduler? One problem is I cannot get the sound duration. Is there any way to get the duration so I can dynamically create a scheduler that loops the sound? As far as I know AudioService does not have built-in looping and other necessry functions, and that's really a pain.
A:
The audio session is different from the thing playing audio. The session manages mixer levels and the basic routing to different things like headphones and speakers and what-not. To loop things is a property of the player.
If you don't need the low-level audio stuff, you might be able to get by with MPMusicPlayerController which has a repeatMode
property you can take advantage of.
Alternatively, there is also the AVAudioPlayer which you can listen for delegate messages and start the playback once it stops to simulate looping yourself.
slf
2010-01-21 18:53:26
I tried AVAudioPlayer but it didn't work. OpenAL seems to be too complicated for the project. I guess I'll try MPMusicPlayer.
Hlung
2010-01-22 09:00:06