如何同步使用的Soundpool声音声音、Soundpool

2023-09-06 04:14:40 作者:熬过去就好了

我一直试图让几个声音同时播放;目前我使用的Soundpool的共享实例。我想1,2或3的声音以完全相同的时间没有延迟播放。

当调用SoundPool.play(...)的连续x次,声音播放的顺序为一体的想象。什么是正确什么来实现这一目标,我可以$所有的声音在同一时间播放p $ ppare,然后发挥他们作为一个?

须藤code:

 的Soundpool _soundPool =新的Soundpool(10,AudioManager.STREAM_MUSIC,0);

_soundPool.load(_context,soundId1,1);
_soundPool.load(_context,soundId2,1);
_soundPool.load(_context,soundId3,1);

_soundPool.play(soundId1,第一卷,第二卷,1,0,1F);
_soundPool.play(soundId2,第一卷,第二卷,1,0,1F);
_soundPool.play(soundId3,第一卷,第二卷,1,0,1F);
 

解决方案

我做的声音池一个声音在时间它可能会帮助你。   安卓声游泳池和服务

android使用SoundPool播放音效的方法

感谢您

I have been trying to get a few sounds to play at the same time; currently i'm using a shared instance of SoundPool. I would like 1, 2 or 3 sounds to be played at the exact same time with no lag.

When calling SoundPool.play(...) X number of times in succession, the sounds are played in that order as one might think. what is the proper what to achieve this where i can prepare all of the sounds to be played at the same time and then play them as one?

Sudo Code:

SoundPool _soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);

_soundPool.load(_context, soundId1, 1);
_soundPool.load(_context, soundId2, 1);
_soundPool.load(_context, soundId3, 1);

_soundPool.play(soundId1, vol, vol, 1, 0, 1f);
_soundPool.play(soundId2, vol, vol, 1, 0, 1f);
_soundPool.play(soundId3, vol, vol, 1, 0, 1f);

解决方案

i done the sound pool for one sound at time it might help you. Android:sound pool and service

Thank you