I have a sound setup that uses AVAudioPlayer. Unfortunately there is always a slight (half second) pause/lag just before the first sound is played. Any sound can get the lag as long as it is the first sound played since the app was first opened. (And it happens again if you swipe the app closed from multitasking, and then open it again.) On the simulator the lag is much longer than it is when just run on my iPad 2.
Any idea what's causing this and how I can stop it from happening?
Extra info:
The code makes a singleton class called SoundsController that makes a dictionary of strings to correspond to sound file names, and has a method called playSound that creates an AVAudioPlayer object, adds it to an array object (which is a class property), and then implements the audioPlayerDidFinishPlaying method to remove the AVAudioPlayer from the array so it can be released.
Any idea what's causing this and how I can stop it from happening?
Extra info:
The code makes a singleton class called SoundsController that makes a dictionary of strings to correspond to sound file names, and has a method called playSound that creates an AVAudioPlayer object, adds it to an array object (which is a class property), and then implements the audioPlayerDidFinishPlaying method to remove the AVAudioPlayer from the array so it can be released.