如何同时播放2种声音 [英] How to play 2 sounds simultaneously

查看:153
本文介绍了如何同时播放2种声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在我的应用程序中播放2种声音...一种是背景声音,另一种是用户单击任何按钮时的声音.....不是我只有一种声音作为背景声音,而该按钮单击却没有太多声音... ..所有声音均为mp3格式....

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....

我正在使用AVAudioPlayer播放这些声音...

I am using AVAudioPlayer to play these sounds...

我的问题是

1-我可以同时播放这2个mp3声音吗?还是应该将该背景声音转换为其他任何格式....

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

2-我正在使用AVAudioPlayer播放这些声音.....所以我可以在同一个类中使用2个AVAudioPlayer实例吗...

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.....

请帮助....

推荐答案

1.,是的,您甚至可以更多.

1., Yes, you can even more..

2.,是的,您可以使用AVAudioPlayer播放这些声音,每个声音源都必须单独分配.

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种声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆