Android Open Source - BulletsForever Audio Sound Pool






From Project

Back to project page BulletsForever.

License

The source code is released under:

GNU General Public License

If you think the Android project BulletsForever listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.bulletsforever.bullets;
//from  w  w  w.ja  v  a 2s .co m
import android.content.Context;
import android.media.AudioManager;
import android.media.SoundPool;

/**
 * This is for playing sound effects
 * This should be set up by GameMain
 */
public class AudioSoundPool {
  
  private SoundPool p;
  private Context c;
  
  // Constructor
  public AudioSoundPool(Context c, int numStreams) {
    this.c = c;
    p = new SoundPool(numStreams, AudioManager.STREAM_MUSIC, 0);
  }
  
  // Load a new wav file, returns a sound ID to reference
  public int load(int resId) {
    return p.load(c, resId, 1);
  }
  public int load(String musicFilePath) {
    return p.load(musicFilePath, 1);
  }
  
  // Control
  public void pauseAll() {
    p.autoPause();
  }
  public void resumeAll() {
    p.autoResume();
  }
  public void play(int soundId) {
    p.play(soundId, 1, 1f, 1, 0, 1);
  }
  public void playLoop(int soundId) {
    p.play(soundId, 1, 1f, 1, -1, 1);
  }
  public void pause(int soundId) {
    p.pause(soundId);
  }
  public void resume(int soundId) {
    p.resume(soundId);
  }
  public void stop(int soundId) {
    p.stop(soundId);
  }
  public void onDestroy() {
    p.release();
  }

}




Java Source Code List

com.bulletsforever.bullets.AudioMusicPlayer.java
com.bulletsforever.bullets.AudioSoundPool.java
com.bulletsforever.bullets.DrawBitmapLoader.java
com.bulletsforever.bullets.DrawKeyHandler.java
com.bulletsforever.bullets.DrawObjectBackground.java
com.bulletsforever.bullets.DrawObjectBoss.java
com.bulletsforever.bullets.DrawObjectBullet.java
com.bulletsforever.bullets.DrawObjectDynamicArm.java
com.bulletsforever.bullets.DrawObjectDynamicBoss.java
com.bulletsforever.bullets.DrawObjectHUD.java
com.bulletsforever.bullets.DrawObjectPlayer.java
com.bulletsforever.bullets.DrawObject.java
com.bulletsforever.bullets.DrawRefreshHandler.java
com.bulletsforever.bullets.DrawTouchHandler.java
com.bulletsforever.bullets.DrawWorld.java
com.bulletsforever.bullets.GameMain.java
com.bulletsforever.bullets.GameScore.java
com.bulletsforever.bullets.MenuHome.java
com.bulletsforever.bullets.MenuSettings.java
com.bulletsforever.bullets.Settings.java
com.bulletsforever.bullets.ToolsFPSCounter.java
com.bulletsforever.bullets.ToolsRandomizer.java
com.bulletsforever.bullets.ToolsScoreboard.java
com.bulletsforever.bullets.ToolsTracker.java
com.bulletsforever.bullets.ToolsVibrator.java