Android Open Source - ssniper-andengine Sound Manager






From Project

Back to project page ssniper-andengine.

License

The source code is released under:

Apache License

If you think the Android project ssniper-andengine 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.cladophora.ssniper;
/*from ww  w.j a v  a 2 s  . co  m*/
import org.andengine.audio.sound.Sound;
import org.andengine.audio.sound.SoundFactory;

import java.io.IOException;

/**
 * Created by jmar on 1/29/14.
 */
public class SoundManager {
    public static Sound mRifleSound;
    public static Sound mRifleBoltSound;
    public static Sound mRifleReloadSound;
    public static Sound mGun1Sound;
    public static Sound mGun2Sound;
    public static Sound mGun3Sound;
    public static Sound mGun4Sound;
    public static Sound mGun5Sound;
    public static Sound mSlowSound;
    public static Sound mBagSound;
    public static Sound mErrorSound;

    static void loadSounds() {
        SoundFactory.setAssetBasePath("sfx/");
        try {
            final BaseActivity context = BaseActivity.getSharedInstance();
            final org.andengine.audio.sound.SoundManager soundManager = context.getSoundManager();
            mRifleSound = SoundFactory.createSoundFromAsset(soundManager, context, "rifle.mp3");
            mRifleBoltSound = SoundFactory.createSoundFromAsset(soundManager, context, "rifle-bolt.mp3");
            mRifleReloadSound = SoundFactory.createSoundFromAsset(soundManager, context, "rifle-reload.mp3");
            mSlowSound = SoundFactory.createSoundFromAsset(soundManager, context, "slow.mp3");
            mGun1Sound = SoundFactory.createSoundFromAsset(soundManager, context, "gun1.mp3");
            mGun2Sound = SoundFactory.createSoundFromAsset(soundManager, context, "gun2.mp3");
            mGun3Sound = SoundFactory.createSoundFromAsset(soundManager, context, "gun3.mp3");
            mGun4Sound = SoundFactory.createSoundFromAsset(soundManager, context, "gun4.mp3");
            mGun5Sound = SoundFactory.createSoundFromAsset(soundManager, context, "gun5.mp3");
            mBagSound = SoundFactory.createSoundFromAsset(soundManager, context, "bag.mp3");
            mErrorSound = SoundFactory.createSoundFromAsset(soundManager, context, "error.mp3");
            final float enemyFiringVolume = 0.20f;
            mGun1Sound.setVolume(enemyFiringVolume);
            mGun2Sound.setVolume(enemyFiringVolume);
            mGun3Sound.setVolume(enemyFiringVolume + 0.10f);
            mGun4Sound.setVolume(enemyFiringVolume);
            mGun5Sound.setVolume(enemyFiringVolume);
        } catch (final IOException e) {
            //Debug.e(e);
            //String msg = "Exception while loading sounds";
            //Log.e("com.cladophora.ssniper.BaseActivity.loadSounds()",msg);
        }
    }
}




Java Source Code List

com.cladophora.ssniper.BaseActivity.java
com.cladophora.ssniper.DeviceUtil.java
com.cladophora.ssniper.EnemyPool.java
com.cladophora.ssniper.GameEffects.java
com.cladophora.ssniper.GameEvents.java
com.cladophora.ssniper.GameLoopUpdateHandler.java
com.cladophora.ssniper.GameUtil.java
com.cladophora.ssniper.HUDManager.java
com.cladophora.ssniper.HoverListener.java
com.cladophora.ssniper.ItemPool.java
com.cladophora.ssniper.LevelLoader.java
com.cladophora.ssniper.PlantPool.java
com.cladophora.ssniper.SPenHoverView.java
com.cladophora.ssniper.ScopeEngine.java
com.cladophora.ssniper.SoundManager.java
com.cladophora.ssniper.SpriteManager.java
com.cladophora.ssniper.andengine.IRandomTimerCallBack.java
com.cladophora.ssniper.andengine.RandomTimerHandler.java
com.cladophora.ssniper.entity.EnemyLayer.java
com.cladophora.ssniper.entity.Enemy.java
com.cladophora.ssniper.entity.ItemLayer.java
com.cladophora.ssniper.entity.Item.java
com.cladophora.ssniper.entity.PlantLayer.java
com.cladophora.ssniper.entity.Plant.java
com.cladophora.ssniper.entity.Reticle.java
com.cladophora.ssniper.entity.Rifle.java
com.cladophora.ssniper.entity.SPen.java
com.cladophora.ssniper.scene.GameScene.java
com.cladophora.ssniper.scene.InstructionScene.java
com.cladophora.ssniper.scene.IntroScene.java
com.cladophora.ssniper.scene.MainMenuScene.java
com.cladophora.ssniper.scene.PauseScene.java
com.cladophora.ssniper.scene.ResultScene.java
com.cladophora.ssniper.scene.ShopScene.java
com.cladophora.ssniper.scene.SplashScene.java
com.cladophora.ssniper.scene.SurvivorIntroScene.java
com.cladophora.ssniper.scene.SurvivorScene.java
com.cladophora.ssniper.scene.TutorialScene.java
com.cladophora.ssniper.scene.WeaponInfoScene.java