iPhone: How many instances of AVAudioPlayer should I have for multiple sounds?

Posted by foreyez on Stack Overflow See other posts from Stack Overflow or by foreyez
Published on 2010-12-28T02:37:43Z Indexed on 2010/12/28 2:54 UTC
Read the original article Hit count: 239

Filed under:
|
|

So I'm using AvAudioPlayer to play multiple wav files. About 20 different sounds (each about 1 sec long), and you can think of each being played on a button press. Also I don't need them all to play simultaneously, i.e., one plays and you press another button to play another one (which stops the currently played one).

What I'm wondering, should I have multiple instances of AVAudioPlayer (20 of them) and then preload the audio files, or should I just use one instance of AvAudioPlayer and each time a button is pressed, initialize the AvAudioPlayer with the sound url (or would this be too slow?)

Thanks in advance!

© Stack Overflow or respective owner

Related posts about iphone

Related posts about sound