// Path: src/net/androidpunk/flashcompat/OnCompleteCallback.java
// public abstract class OnCompleteCallback {
// 	public abstract void completed();
// }


import java.util.Vector;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.SoundPool;
import net.androidpunk.flashcompat.OnCompleteCallback;

package net.androidpunk;



/**
 * Sound effect object used to play embedded sounds.
 */
public class Sfx {
	
	private static final String TAG = "Sfx";
	
	/**
	 * Optional callback function for when the sound finishes playing.
	 */
	public OnCompleteCallback complete;
	
	private static float GLOBAL_VOLUME = 1.0f;
	private static float GLOBAL_PAN = 0.0f;
	
	public static SoundPool SOUND_POOL = new SoundPool(32, AudioManager.STREAM_MUSIC, 0);
	public static final Vector<Sfx> SOUNDS = new Vector<Sfx>();
	
	private int mSoundId;
	private int mStreamId;
	
	// Sound infromation.
	private float mVolume = 1.0f;
	private float mPan = 0.0f;
	private boolean mLooping = false;
	private boolean mPlayed = false;
	
	public static void setMasterVolume(float volume) {
		GLOBAL_VOLUME = volume;
		for(Sfx s : SOUNDS) {
			// reset using the new global volume
			s.setVolume(s.getVolume());
		}
	}
	
	public static void setMasterPan(float pan) {
		GLOBAL_PAN = pan;
		for(Sfx s : SOUNDS) {
			// reset using the new global pan
			s.setPan(s.getPan());
		}
	}
	
	/**
	 * Creates a sound effect from an raw resource. Store a reference to
	 * this object so that you can play the sound using play() or loop().
	 * @param	source		The embedded sound resource to use.
	 */
	public Sfx(int resId) {
		this(resId, null);
	}
	
	/**
	 * Creates a sound effect from an raw resource. Store a reference to
	 * this object so that you can play the sound using play() or loop().
	 * @param	source		The embedded sound resource to use.
	 * @param	complete	Optional callback function for when the sound finishes playing.
	 */

// Path: src/net/androidpunk/flashcompat/OnCompleteCallback.java
// public abstract class OnCompleteCallback {
// 	public abstract void completed();
// }


// Path: src/net/androidpunk/Sfx.java
import java.util.Vector;
import android.content.res.AssetFileDescriptor;
import android.media.AudioManager;
import android.media.SoundPool;
import net.androidpunk.flashcompat.OnCompleteCallback;

package net.androidpunk;



/**
 * Sound effect object used to play embedded sounds.
 */
public class Sfx {
	
	private static final String TAG = "Sfx";
	
	/**
	 * Optional callback function for when the sound finishes playing.
	 */
	public OnCompleteCallback complete;
	
	private static float GLOBAL_VOLUME = 1.0f;
	private static float GLOBAL_PAN = 0.0f;
	
	public static SoundPool SOUND_POOL = new SoundPool(32, AudioManager.STREAM_MUSIC, 0);
	public static final Vector<Sfx> SOUNDS = new Vector<Sfx>();
	
	private int mSoundId;
	private int mStreamId;
	
	// Sound infromation.
	private float mVolume = 1.0f;
	private float mPan = 0.0f;
	private boolean mLooping = false;
	private boolean mPlayed = false;
	
	public static void setMasterVolume(float volume) {
		GLOBAL_VOLUME = volume;
		for(Sfx s : SOUNDS) {
			// reset using the new global volume
			s.setVolume(s.getVolume());
		}
	}
	
	public static void setMasterPan(float pan) {
		GLOBAL_PAN = pan;
		for(Sfx s : SOUNDS) {
			// reset using the new global pan
			s.setPan(s.getPan());
		}
	}
	
	/**
	 * Creates a sound effect from an raw resource. Store a reference to
	 * this object so that you can play the sound using play() or loop().
	 * @param	source		The embedded sound resource to use.
	 */
	public Sfx(int resId) {
		this(resId, null);
	}
	
	/**
	 * Creates a sound effect from an raw resource. Store a reference to
	 * this object so that you can play the sound using play() or loop().
	 * @param	source		The embedded sound resource to use.
	 * @param	complete	Optional callback function for when the sound finishes playing.
	 */

	public Sfx(int resId, OnCompleteCallback completeFunction) {
