0

我正在尝试编写一个声音应用程序,在单击按钮时我想一个接一个地播放 3-4 个声音文件。如何才能做到这一点?我也想增加文件的播放时间。这是播放函数中使用循环变量的地方吗?

这是我用 SoundPool 完成的部分代码。但是所有文件都同时播放:(

        public void onClick(View v){
            //check for scan button
            if(v.getId()==R.id.playbutton){
                queueSound(1000);
                sound.changePitchfile3(R.raw.a0);
                queueSound(5000);
                sound.changePitchfile2(R.raw.a1);
                queueSound(10000);
                sound.changePitchfile3(R.raw.a3);

            }
        }
    });

}
 private void queueSound(final long delay) {
        new Handler().postDelayed(new Runnable() {
          @Override
          public void run() {
          }}, delay);

public void changePitchfile1(int res1) {
    int soundId = (Integer) mSounds.get(res1);
    this.myPlayer.play(soundId, 1, 1, 0, 0,1.125f);
}
4

0 回答 0