android - 音池中的多点触摸

标签 android button soundpool multi-touch

如何在 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);
    }
});

最佳答案

关于android - 音池中的多点触摸,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11876621/

相关文章:

android - 在 unityscript 中调用脚本很慢吗?

android - 在按钮上应用颜色过滤器

android - 应用程序加载后立即启动音频 Android 应用程序

javascript - 如何编写一个 JS 按钮来激活单击和滚动时的转换?

css - Bootstrap 按钮和加载动画

android - Android 版本大于 4.0 时声音无法播放

android - Android:按钮会在onClick播放2种声音

java - JSOUP 如何使用 HTTPS 自签名认证登录

java - 无法实例化抽象类 'base.CreditCard'

android - 如何在android中使用 Material 设计制作多色不确定线性进度指示器?