Code example for SoundPool

0
     * @param context the context from your application 
     */ 
    public static void initialize(Context context) {
        //Log.e("Orbotix", "initialized"); 
        sInstance.mAudioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE);
        sInstance.mSoundPool = new SoundPool(4, AudioManager.STREAM_MUSIC, 0);
        sInstance.mSoundMap = new SparseIntArray();
    } 
 
    /** 
     * Adds a sound to the sound manager for future playback. 
     * @param soundIdentifier the identifier for this sound to be used for future playback. This will be the id 
     * used to play the sound using {@link #playSound(int)}. 
     * @param resourceId the resource id of the sound file itself. (e.g. R.raw.swoosh_sound) 
     */ 
    public static void addSound(Context context, int soundIdentifier, int resourceId) {
        sInstance.mSoundMap.append(soundIdentifier, sInstance.mSoundPool.load(context, resourceId, 1));
    } 
 
    /** 
     * Adds a sound to the sound manager for future playback.