Development #37
@@ -24,6 +24,8 @@ public class AcousticHandler {
|
|||||||
private GameMusic scheduled = null; // Scheduled track to play next
|
private GameMusic scheduled = null; // Scheduled track to play next
|
||||||
private GameMusic old = null; // Old track being faded out
|
private GameMusic old = null; // Old track being faded out
|
||||||
|
|
||||||
|
private GameMusic birds;
|
||||||
|
|
||||||
private float mainVolume = 0.0f;
|
private float mainVolume = 0.0f;
|
||||||
private float musicVolume = 1.0f;
|
private float musicVolume = 1.0f;
|
||||||
private float soundVolume = 1.0f;
|
private float soundVolume = 1.0f;
|
||||||
@@ -38,6 +40,8 @@ public AcousticHandler(MdgaApp app) {
|
|||||||
mainVolume = prefs.getFloat("mainVolume", 1.0f);
|
mainVolume = prefs.getFloat("mainVolume", 1.0f);
|
||||||
musicVolume = prefs.getFloat("musicVolume", 1.0f);
|
musicVolume = prefs.getFloat("musicVolume", 1.0f);
|
||||||
soundVolume = prefs.getFloat("soundVolume", 1.0f);
|
soundVolume = prefs.getFloat("soundVolume", 1.0f);
|
||||||
|
|
||||||
|
birds = new GameMusic(app, MusicAsset.BIRDS, getSoundVolumeTotal(), MusicAsset.BIRDS.getSubVolume(), MusicAsset.BIRDS.getLoop(), 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,6 +64,8 @@ public void update() {
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
birds.update(Math.min(getSoundVolumeTotal(), getMusicVolumeTotal() > 0 ? 0 : 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -153,6 +159,8 @@ public void playState(MdgaState state) {
|
|||||||
}
|
}
|
||||||
MusicAsset asset = null;
|
MusicAsset asset = null;
|
||||||
|
|
||||||
|
birds.pause();
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case MAIN:
|
case MAIN:
|
||||||
playGame = false;
|
playGame = false;
|
||||||
@@ -163,6 +171,7 @@ public void playState(MdgaState state) {
|
|||||||
asset = MusicAsset.LOBBY;
|
asset = MusicAsset.LOBBY;
|
||||||
break;
|
break;
|
||||||
case GAME:
|
case GAME:
|
||||||
|
birds.play();
|
||||||
addGameTracks();
|
addGameTracks();
|
||||||
playGame = true;
|
playGame = true;
|
||||||
assert (!gameTracks.isEmpty()) : "no more game music available";
|
assert (!gameTracks.isEmpty()) : "no more game music available";
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ enum MusicAsset {
|
|||||||
GAME_3("TheSynthRave.wav", 1.0f),
|
GAME_3("TheSynthRave.wav", 1.0f),
|
||||||
GAME_4("LaserParty.wav", 1.0f),
|
GAME_4("LaserParty.wav", 1.0f),
|
||||||
GAME_5("RetroNoir.wav", 1.0f),
|
GAME_5("RetroNoir.wav", 1.0f),
|
||||||
GAME_6("SpaceInvaders.wav", 1.0f);
|
GAME_6("SpaceInvaders.wav", 1.0f),
|
||||||
|
BIRDS("nature-ambience.ogg", true, 1.0f);
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
private final boolean loop;
|
private final boolean loop;
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user