How to play 2 sounds simultaneously

这一生的挚爱 提交于 2019-12-08 12:54:40

问题


I have to play 2 sounds in my app...one for background and one for when user clicks any button.....Not i have only one sound for background and too many sounds for that button click.....all sounds are in mp3 format....

I am using AVAudioPlayer to play these sounds...

My questions are

1- Can i play these 2 mp3 sounds at same time Or should i convert that background sound to any other format....

2- I am using AVAudioPlayer to play these sounds.....so can i use 2 instances of AVAudioPlayer in same class......

Please Note that i want that background music continuously playing.....

Please help....


回答1:


1., Yes, you can even more..

2., Yes you can use AVAudioPlayer to play these, each sound source have to be allocated separately.

If you have short sounds that does not need to be stereo, you can use system sound framework to make them play.




回答2:


Have a look to below look, will helpful for you.

2 mp3 sounds at the same time in iphone?

and blog tutorial

http://brainwashinc.wordpress.com/2009/08/14/iphone-playing-2-sounds-at-once/



来源:https://stackoverflow.com/questions/5828951/how-to-play-2-sounds-simultaneously

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!