From 28eb6a408045971d79b379ac5ef408cf6b84ecbd Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Wed, 29 Apr 2015 12:56:33 +0200 Subject: Cleanup; victory sound --- .../com/camilstaps/rushhour/GamePlayActivity.java | 26 ++-------------------- 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java') diff --git a/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java b/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java index c5740b3..8399446 100755 --- a/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java +++ b/app/src/main/java/com/camilstaps/rushhour/GamePlayActivity.java @@ -31,9 +31,6 @@ import java.io.InputStream; public class GamePlayActivity extends Activity implements Board.SolveListener { - private SoundPool soundPool; - private int soundBackgroundId, soundCarDriveId, soundCantMoveId; - Board board; boolean isFirstTime = true; @@ -44,7 +41,6 @@ public class GamePlayActivity extends Activity implements Board.SolveListener { setContentView(R.layout.activity_fullscreen); - setupSoundPool(); setupBoard(); } @@ -76,12 +72,12 @@ public class GamePlayActivity extends Activity implements Board.SolveListener { board.setDriveListener(new DriveListener() { @Override public void onDrive() { - soundPool.play(soundCarDriveId, 1, 1, 1, 0, 1); + TheSoundPool.getSoundPool(getBaseContext()).play(TheSoundPool.soundCarDriveId, 1, 1, 1, 0, 1); } @Override public void onBlocked() { - soundPool.play(soundCantMoveId, 1, 1, 1, 0, 1); + TheSoundPool.getSoundPool(getBaseContext()).play(TheSoundPool.soundCantMoveId, 1, 1, 1, 0, 1); } }); @@ -98,24 +94,6 @@ public class GamePlayActivity extends Activity implements Board.SolveListener { } } - /** - * Load sounds; start background music - */ - protected void setupSoundPool() { - soundPool = new SoundPool(2, AudioManager.STREAM_MUSIC, 0); - soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() { - @Override - public void onLoadComplete(SoundPool soundPool, int sampleId, int status) { - if (sampleId == soundBackgroundId) { - soundPool.play(soundBackgroundId, 1, 1, 2, -1, 1); - } - } - }); - soundBackgroundId = soundPool.load(this, R.raw.tune, 2); - soundCarDriveId = soundPool.load(this, R.raw.car_drive, 1); - soundCantMoveId = soundPool.load(this, R.raw.cantmove, 1); - } - @Override public void onSolve(int score) { Intent intent = new Intent(this, FinishedActivity.class); -- cgit v1.2.3