package com.google.sprint1;

import android.content.Context;
import android.media.AudioManager;
import android.media.MediaPlayer;
import android.media.SoundPool;

public class Sound {
	
	
	public static void playBackgroundMusic(Context context){
	
	MediaPlayer backgroundMusic;
	backgroundMusic = MediaPlayer.create(context, R.raw.good);
	
	backgroundMusic.setLooping(true);
	backgroundMusic.setVolume(10.0f, 3.0f);
	backgroundMusic.start();
	
	}
	
	public static void playsoundEffect(Context context){
		
		
		//Vill anvnda SoundPool istllet fr mediaplayer
		/*SoundPool sp;
		
		sp = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);
		
		int soundIds[] = new int[10];
		soundIds[0] = sp.load(context, R.raw.ping, 1);
		
		sp.play(soundIds[0], 1, 1, 1, 0, (float) 1.0);*/
		
		MediaPlayer backgroundMusic;
		backgroundMusic = MediaPlayer.create(context, R.raw.ping);
		
		backgroundMusic.setLooping(false);
		backgroundMusic.setVolume(10.0f, 3.0f);
		backgroundMusic.start();
	}

}

@@ -159,31 +159,702 @@
 ol;%0A
-%0Apublic class Sound %7B%0A%09
+import android.media.SoundPool.OnLoadCompleteListener;%0Aimport android.util.Log;%0A%0Apublic class Sound %7B%0A%09%0A%09static boolean loaded = false;%0A%09%0A%09public static int%5B%5D loadSound(Context context)%7B%0A%09%09%0A%09%09SoundPool soundPool;%0A%09%09soundPool = new SoundPool(10, AudioManager.STREAM_MUSIC, 0);%0A%09%09int soundIds%5B%5D = new int%5B10%5D;%0A%09%09soundIds%5B0%5D = soundPool.load(context, R.raw.ping, 1);%0A%09%09%0A%09%09soundPool.setOnLoadCompleteListener(new OnLoadCompleteListener()%7B%0A%0A%09%09%09@Override%0A%09%09%09public void onLoadComplete(SoundPool soundPool, int sampleId,%0A%09%09%09%09%09int status) %7B%0A%09%09%09%09loaded = true;%0A%09%09%09%09%0A%09%09%09%7D%0A%09%09%09%0A%09%09%7D);%0A%09%09%0A%09%09Log.e(%22Test%22, %22soundID before = %22 + soundIds%5B0%5D);%0A%09%09Log.e(%22Test%22, %22Loaded = %22 + loaded);%0A%09%09%0A%09%09return soundIds;%0A%09%09%0A%09%09%7D
 %0A%09%0A%09
@@ -1153,68 +1153,63 @@
 ect(
-Context context)%7B%0A%09%09%0A%09%09%0A%09%09//Vill anvnda S
+int soundID)%7B%0A%09%09%0A%09%09%0A%09%09//should use s
 ound
-P
+p
 ool i
+n
 st
-llet fr
+eed of
  med
@@ -1433,16 +1433,18 @@
 0);*/%0A%09%09
+/*
 %0A%09%09Media
@@ -1637,14 +1637,207 @@
 tart();%0A
+%09%09*/%0A%09%09%0A%09%09SoundPool soundPool;%0A%09%09soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0);%0A%09%09%0A%09%09Log.e(%22Test%22, %22soundID play = %22 + soundID);%0A%09%09%0A%09%09soundPool.play(soundID, 1, 1, 1, 0, 1.0f);%0A%09%09%0A
 %09%7D%0A%0A%7D%0A

load class