如何在 soundpool 中进行多次触摸?我有 3 个按钮。当手指滑动触摸按钮时,就像钢琴中的声音?这是我的代码:
sp = new SoundPool (5, AudioManager.STREAM_MUSIC, 0);
player1 = sp.load(this, R.raw.ndang, 1);
player2 = sp.load(this, R.raw.nding, 1);
player3 = sp.load(this, R.raw.ndung, 1);
ndang = (ImageButton) this.findViewById(R.id.ndang);
ndang.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
sp.play(player1, 1, 1, 0, 0, 1);
}
});
ndang = (ImageButton) this.findViewById(R.id.ndang2);
ndang.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
sp.play(player1, 1, 1, 0, 0, 1);
}
});
nding = (ImageButton) this.findViewById(R.id.nding);
nding.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
sp.play(player2, 1, 1, 0, 0, 1);
}
});