[1213-Screen+Shot+2012-06-10+at+4.23.39+PM.png|1213]I’m experiencing a considerable processor load spike when playing a short sound on iOS. I’ve tried compressed sounds, decompressed sounds, and just about anything else. The issue is that I load a sound into an audio source using myAudioSource.clip = nameOfClip; then I play it using myAudioSource.Play(); It rewards me with up to a 23ms time to process for AudioManager.Update. The issue is that it will cause the iPhone to lag out and FMOD seems to have a hard time recovering.
Eventually the iPhone will recover after 30 seconds or so. What is the best way to load in and play clips to avoid this huge processor spike?
I have 11 playing sources and 9 audio voices. At 11 playing sources and 8 audio voices, the processing time is only around 2ms.
This thread is really old but it is the only one I found so far with this topic. I searched for this as I was having spikes when a clip would play. I have several unique voice overs for characters in the game but I only need two specific characters for each scene so I use “Resources.LoadAll (playerName);” to “load” the clips that will be used. However, I think what I have discovered that this does not actually load a clip in preparation to be played but rather just assigns it to an array spot. So then when I actually play the clip the audiosource has to actually load the clip as well. This was apparently causing my spikes.
To fix this I used a for loop and called LoadAudioData() on each clip to preload it. Starting the scene now takes a bit longer but it seems to have eliminated the sound lag spike. It would be nice if we could set the Load In Background property of Audio files in code, but it appears this isn’t possible.