기본 콘텐츠로 건너뛰기

Android, SoundPool, play wav





SoundPool sPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
final int intRaw = sPool.load(this, R.raw.sample1, 1);

Button btn = (Button)findViewById(R.id.button1);
btn.setSoundEffectsEnabled(false);
btn.setOnClickListener(new View.OnClickListener() {
            @Override            public void onClick(View view) {
                    sPool.play(intRaw, 1, 1, 0, 0, 1);
            }
}

댓글