如何同步使用的Soundpool声音 [英] How to Sync Sounds using SoundPool

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

问题描述

我一直试图让几个声音同时播放;目前我使用的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);
 

解决方案

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

感谢您

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

这篇关于如何同步使用的Soundpool声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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