@Override public void onClick(View v) { // TODO Auto-generated method stub switch(v.getId()) { case R.id.low : pitch = 0.5f;playit();break;
case R.id.normal: pitch = 1.0f;playit();break;
case R.id.high: pitch = 2.0f;playit();break; }
}
private void playit() { // TODO Auto-generated method stub sp = new SoundPool(1,AudioManager.STREAM_MUSIC,0); final int i = sp.load(this, R.raw.music, 0); sp.setOnLoadCompleteListener(new OnLoadCompleteListener() {
@Override public void onLoadComplete(SoundPool arg0, int arg1, int arg2) { // TODO Auto-generated method stub sp.play(i, 1,1,0,0,pitch); }
Comments
Post a Comment