播放两种声音Simutaneosly两种、声音、Simutaneosly

由网友(你的小祖宗)分享简介:我想在android.I simutaneosly发挥两个声音已经创建了两个MediaPlayers和现在用的是code below.They another.Or后,当前正在播放的一个又一个不完全是一个,但有点推迟到海誓山盟。I am trying to play two sounds simutaneosly i...

我想在android.I simutaneosly发挥两个声音已经创建了两个MediaPlayers和现在用的是code below.They another.Or后,当前正在播放的一个又一个不完全是一个,但有点推迟到海誓山盟。

I am trying to play two sounds simutaneosly in android.I have created two MediaPlayers and am using the code below.They are currently playing one after another.Or not exactly one after another but kinda delayed into eachother.

private void playSound(){
       if (mp1 != null) {
           mp1.release(); 
        }
       if (mp2 != null) {
            mp2.release(); 
         }


        mp1 = MediaPlayer.create(this, soundArray[0]); 
        mp2 = MediaPlayer.create(this, soundArray[3]);
        mp1.start();
        mp2.start();

      }

感谢

推荐答案

同时播放两路数字声音就是这么简单相加在一起(如在现实世界中),所以你可以做自己,而填充缓冲区(和有控制时间)。

Playing two digital sounds simultaneously is as simple as summing them together (as in the real world), so you could do that yourself while filling the buffer (and have control over timing).

这可能会导致幅度提高,因此应注意不要超过数组类型的数值范围,如果你不希望引起削波假象。

This could cause the amplitude to raise, so care should be taken to not surpass the numeric bounds of the array type if you don't want to cause clipping artifacts.

​​这个问题,并回答也可能会有所帮助。

阅读全文

相关推荐

最新文章