Added audio files. (Credit: Allexit)

This commit is contained in:
Jeasonfire 2015-05-17 23:58:43 +03:00
parent 78b4204cd3
commit 48218fca7c
23 changed files with 201 additions and 0 deletions

View File

@ -0,0 +1,37 @@
Attributions
============
Matthew Pablo
-------------
- Music
- Theme.ogg
- Source: http://opengameart.org/content/you-were-my-brother-live-orchestra
- Original Name/Format(s): Tropic Strike - 1M2 - _You Were My Brother_.mp3
- Additional info: http://www.matthewpablo.com/
Iwan Gabovitch
--------------
- SFX
- Hit01.ogg ... Hit05.ogg
- Source: http://opengameart.org/content/15-vocal-male-strainhurtpainjump-sounds
- Original Name/Format(s): slightscream-03.flac, slightscream-04.flac, slightscream-05.flac, slightscream-10.flac, slightscream-14.flac
- Additional info: -
Ogrebane
========
- SFX
- clang01.ogg .. clang04.ogg
- Source: http://opengameart.org/content/metal-and-wood-impact-sound-effects
- Original Name/Format(s): metal10.aif .. metal14.aif
- Additional info: -
Kenney
======
- SFX
- button_press.ogg
- Source: http://opengameart.org/content/51-ui-sound-effects-buttons-switches-and-clicks
- Original Name/Format(s): switch31.wav
- Additional info: www.kenney.nl

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
core/assets/audio/hit01.ogg Normal file

Binary file not shown.

BIN
core/assets/audio/hit02.ogg Normal file

Binary file not shown.

BIN
core/assets/audio/hit03.ogg Normal file

Binary file not shown.

BIN
core/assets/audio/hit04.ogg Normal file

Binary file not shown.

BIN
core/assets/audio/hit05.ogg Normal file

Binary file not shown.

BIN
core/assets/audio/step.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
core/assets/audio/theme.ogg Normal file

Binary file not shown.

View File

@ -18,7 +18,10 @@ import com.saltosion.gladiator.systems.ParticleSystem;
import com.saltosion.gladiator.systems.PhysicsSystem;
import com.saltosion.gladiator.systems.RenderingSystem;
import com.saltosion.gladiator.util.AppUtil;
import com.saltosion.gladiator.util.AudioLoader;
import com.saltosion.gladiator.util.Jukebox;
import com.saltosion.gladiator.util.Log;
import com.saltosion.gladiator.util.SpriteLoader;
public class GladiatorBrawler extends ApplicationAdapter {
@ -27,6 +30,7 @@ public class GladiatorBrawler extends ApplicationAdapter {
private LevelFactory levelFactory;
private GUIManager guiManager;
private InputHandler inputHandler;
private Jukebox jukebox;
private BaseState currentState;
@ -50,6 +54,10 @@ public class GladiatorBrawler extends ApplicationAdapter {
// Initialize GUI
guiManager = new GUIManager();
AppUtil.guiManager = this.guiManager;
// Initialize Jukebox
jukebox = new Jukebox();
AppUtil.jukebox = this.jukebox;
// Initialize input
inputHandler = new InputHandler();
@ -136,5 +144,7 @@ public class GladiatorBrawler extends ApplicationAdapter {
currentState.destroy();
}
AppUtil.engine.getSystem(RenderingSystem.class).dispose();
SpriteLoader.dispose();
AudioLoader.dispose();
}
}

View File

@ -11,6 +11,7 @@ public class AppUtil {
public static Entity player;
public static Engine engine;
public static Jukebox jukebox;
public static EntityFactory entityFactory;
public static LevelFactory levelFactory;
public static GUIManager guiManager;

View File

@ -0,0 +1,60 @@
package com.saltosion.gladiator.util;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
import java.util.HashMap;
public class AudioLoader {
private static HashMap<String, Sound> sounds = new HashMap<String, Sound>();
private static HashMap<String, Music> musics = new HashMap<String, Music>();
static {
// Import all the sounds & musix
AudioLoader.musics.put(Name.MUSIC_THEME, loadMusic("audio/theme.ogg"));
AudioLoader.musics.put(Name.MUSIC_BATTLE, loadMusic("audio/battle_music.ogg"));
AudioLoader.sounds.put(Name.SOUND_SWING01, loadSound("audio/swing01.ogg"));
AudioLoader.sounds.put(Name.SOUND_SWING02, loadSound("audio/swing02.ogg"));
AudioLoader.sounds.put(Name.SOUND_SWING03, loadSound("audio/swing03.ogg"));
AudioLoader.sounds.put(Name.SOUND_HIT01, loadSound("audio/hit01.ogg"));
AudioLoader.sounds.put(Name.SOUND_HIT02, loadSound("audio/hit02.ogg"));
AudioLoader.sounds.put(Name.SOUND_HIT03, loadSound("audio/hit03.ogg"));
AudioLoader.sounds.put(Name.SOUND_HIT04, loadSound("audio/hit04.ogg"));
AudioLoader.sounds.put(Name.SOUND_HIT05, loadSound("audio/hit05.ogg"));
AudioLoader.sounds.put(Name.SOUND_CLANG01, loadSound("audio/clang01.ogg"));
AudioLoader.sounds.put(Name.SOUND_CLANG02, loadSound("audio/clang02.ogg"));
AudioLoader.sounds.put(Name.SOUND_CLANG03, loadSound("audio/clang03.ogg"));
AudioLoader.sounds.put(Name.SOUND_CLANG04, loadSound("audio/clang04.ogg"));
AudioLoader.sounds.put(Name.SOUND_STEP, loadSound("audio/step.ogg"));
AudioLoader.sounds.put(Name.SOUND_BUTTON_PRESS, loadSound("audio/button_press.ogg"));
AudioLoader.sounds.put(Name.SOUND_BUTTON_RELEASE, loadSound("audio/button_release.ogg"));
}
private static Music loadMusic(String path) {
return Gdx.audio.newMusic(Gdx.files.internal(path));
}
private static Sound loadSound(String path) {
return Gdx.audio.newSound(Gdx.files.internal(path));
}
public static Sound getSound(String id) {
return sounds.get(id);
}
public static Music getMusic(String id) {
return musics.get(id);
}
public static void dispose() {
Log.info("Disposed sounds and musics!");
for (String s : sounds.keySet()) {
sounds.get(s).dispose();
}
for (String s : musics.keySet()) {
musics.get(s).dispose();
}
}
}

View File

@ -0,0 +1,75 @@
package com.saltosion.gladiator.util;
import com.badlogic.gdx.audio.Music;
import com.badlogic.gdx.audio.Sound;
public class Jukebox {
private Music currentMusic;
private float volume = 1;
/**
* Plays the musix like a baws.
* @param music
* @return boolean if the musix failed to play
*/
public boolean playMusic(Music music) {
if (music == null) {
currentMusic.stop();
currentMusic = null;
}
if (music.equals(currentMusic)) {
return false;
} if (currentMusic != null) { currentMusic.stop(); };
music.play();
music.setVolume(volume);
music.setLooping(true);
currentMusic = music;
return true;
}
public Music getCurrentMusic() {
return this.currentMusic;
}
public void setMusicVolume(float volume) {
this.volume = volume;
if (currentMusic == null) {return;}
this.currentMusic.setVolume(volume);
}
/**
* Simply plays the sound
* @param sound
* @return long returns sound's id
*/
public long playSound(Sound sound) {
return sound.play();
}
/**
* Play sound and set it's volume
* @param sound
* @param volume 0-1f
* @return long returns sound's id
*/
public long playSound(Sound sound, float volume) {
long id = playSound(sound);
sound.setVolume(id, volume);
return id;
}
/**
* Play sound and set it's volume & pan
* @param sound
* @param volume 0-1f
* @param pan ?
* @return long returns sound's id
*/
public long playSound(Sound sound, float volume, float pan) {
long id = playSound(sound);
sound.setPan(id, pan, volume);
return id;
}
}

View File

@ -35,4 +35,22 @@ public class Name {
public static final String SWING_UP = "SWING_UP";
public static final String SWING_DOWN = "SWING_DOWN";
public static final String MUSIC_THEME = "MUSIC_THEME";
public static final String MUSIC_BATTLE = "MUSIC_BATTLE";
public static final String SOUND_SWING01 = "SOUND_SWING01";
public static final String SOUND_SWING02 = "SOUND_SWING02";
public static final String SOUND_SWING03 = "SOUND_SWING03";
public static final String SOUND_HIT01 = "SOUND_HIT01";
public static final String SOUND_HIT02 = "SOUND_HIT02";
public static final String SOUND_HIT03 = "SOUND_HIT03";
public static final String SOUND_HIT04 = "SOUND_HIT04";
public static final String SOUND_HIT05 = "SOUND_HIT05";
public static final String SOUND_CLANG01 = "SOUND_CLANG01";
public static final String SOUND_CLANG02 = "SOUND_CLANG02";
public static final String SOUND_CLANG03 = "SOUND_CLANG03";
public static final String SOUND_CLANG04 = "SOUND_CLANG04";
public static final String SOUND_STEP = "SOUND_STEP";
public static final String SOUND_BUTTON_PRESS = "SOUND_BUTTON_PRESS";
public static final String SOUND_BUTTON_RELEASE = "SOUND_BUTTON_RELEASE";
}