How to sync sounds using SoundPool

I tried to play several sounds at the same time; I am currently using a generic instance of SoundPool. I would like 1, 2 or 3 sounds to be played at the same time without lag.

When you call SoundPool.play (...) X several times in a row, sounds are played in the order you would think. What is the correct way to achieve this when I can prepare all the sounds that will play 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); 
+7
android audio soundpool android-audiomanager
source share
1 answer

I made a sound pool for one sound at a time when it can help you. Android: sound pool and service

thanks

0
source share

All Articles