Minor improvements
This commit is contained in:
@@ -18,7 +18,7 @@ public class AcousticHandler {
|
|||||||
|
|
||||||
private boolean fading = false; // Indicates if a fade is in progress
|
private boolean fading = false; // Indicates if a fade is in progress
|
||||||
private NanoTimer fadeTimer = new NanoTimer(); // Timer to track fade progress
|
private NanoTimer fadeTimer = new NanoTimer(); // Timer to track fade progress
|
||||||
private static final float FADE_DURATION = 3.0f; // Duration for outfade
|
private static final float FADE_DURATION = 2.0f; // Duration for outfade
|
||||||
private static final float CROSSFADE_DURATION = 1.5f; // Duration for infade
|
private static final float CROSSFADE_DURATION = 1.5f; // Duration for infade
|
||||||
private GameMusic playing = null; // Currently playing track
|
private GameMusic playing = null; // Currently playing track
|
||||||
private GameMusic scheduled = null; // Scheduled track to play next
|
private GameMusic scheduled = null; // Scheduled track to play next
|
||||||
@@ -161,6 +161,8 @@ public void playState(MdgaState state) {
|
|||||||
|
|
||||||
birds.pause();
|
birds.pause();
|
||||||
|
|
||||||
|
float pause = 0.0f;
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case MAIN:
|
case MAIN:
|
||||||
playGame = false;
|
playGame = false;
|
||||||
@@ -176,6 +178,7 @@ public void playState(MdgaState state) {
|
|||||||
playGame = true;
|
playGame = true;
|
||||||
assert (!gameTracks.isEmpty()) : "no more game music available";
|
assert (!gameTracks.isEmpty()) : "no more game music available";
|
||||||
asset = gameTracks.remove(0);
|
asset = gameTracks.remove(0);
|
||||||
|
pause = 2.0f;
|
||||||
break;
|
break;
|
||||||
case CEREMONY:
|
case CEREMONY:
|
||||||
playGame = false;
|
playGame = false;
|
||||||
@@ -187,7 +190,7 @@ public void playState(MdgaState state) {
|
|||||||
|
|
||||||
assert (null != asset) : "music sceduling went wrong";
|
assert (null != asset) : "music sceduling went wrong";
|
||||||
|
|
||||||
scheduled = new GameMusic(app, asset, getMusicVolumeTotal(), asset.getSubVolume(), asset.getLoop(), 0.0f);
|
scheduled = new GameMusic(app, asset, getMusicVolumeTotal(), asset.getSubVolume(), asset.getLoop(), pause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -258,12 +261,6 @@ private void updateVolumeAndTrack() {
|
|||||||
} else if (playing != null) {
|
} else if (playing != null) {
|
||||||
// Update volume for the currently playing track
|
// Update volume for the currently playing track
|
||||||
playing.update(getMusicVolumeTotal());
|
playing.update(getMusicVolumeTotal());
|
||||||
} else if (scheduled != null) {
|
|
||||||
// If no track is playing and one is scheduled, start it immediately at full volume
|
|
||||||
playing = scheduled;
|
|
||||||
scheduled = null;
|
|
||||||
playing.play();
|
|
||||||
playing.update(getMusicVolumeTotal()); // Set volume to full
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -463,7 +460,7 @@ public void setSoundVolume(float soundVolume) {
|
|||||||
*/
|
*/
|
||||||
float getMusicVolumeTotal() {
|
float getMusicVolumeTotal() {
|
||||||
|
|
||||||
return getMusicVolume() * getMainVolume();
|
return getMusicVolume() * getMainVolume() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -10,12 +10,12 @@ enum MusicAsset {
|
|||||||
MAIN_MENU("Spaceship.wav", true, 1.0f),
|
MAIN_MENU("Spaceship.wav", true, 1.0f),
|
||||||
LOBBY("DeadPlanet.wav", true, 1.0f),
|
LOBBY("DeadPlanet.wav", true, 1.0f),
|
||||||
CEREMONY("80s,Disco,Life.wav", true, 1.0f),
|
CEREMONY("80s,Disco,Life.wav", true, 1.0f),
|
||||||
GAME_1("NeonRoadTrip.wav", 1.0f),
|
GAME_1("NeonRoadTrip.wav", 0.5f),
|
||||||
GAME_2("NoPressureTrance.wav", 1.0f),
|
GAME_2("NoPressureTrance.wav", 0.5f),
|
||||||
GAME_3("TheSynthRave.wav", 1.0f),
|
GAME_3("TheSynthRave.wav", 0.5f),
|
||||||
GAME_4("LaserParty.wav", 1.0f),
|
GAME_4("LaserParty.wav", 0.5f),
|
||||||
GAME_5("RetroNoir.wav", 1.0f),
|
GAME_5("RetroNoir.wav", 0.5f),
|
||||||
GAME_6("SpaceInvaders.wav", 1.0f),
|
GAME_6("SpaceInvaders.wav", 0.5f),
|
||||||
BIRDS("nature-ambience.ogg", true, 1.0f);
|
BIRDS("nature-ambience.ogg", true, 1.0f);
|
||||||
|
|
||||||
private final String path;
|
private final String path;
|
||||||
|
|||||||
@@ -231,7 +231,7 @@ public String getName() {
|
|||||||
"FluffiKopf",
|
"FluffiKopf",
|
||||||
"DonutDöner",
|
"DonutDöner",
|
||||||
"VollpfostenX",
|
"VollpfostenX",
|
||||||
"Schraubenschlüssel",
|
"Waschlappen",
|
||||||
"Witzepumper",
|
"Witzepumper",
|
||||||
"ToastTraum",
|
"ToastTraum",
|
||||||
"FroschFighter",
|
"FroschFighter",
|
||||||
@@ -288,22 +288,22 @@ public String getName() {
|
|||||||
"VulkanKeks",
|
"VulkanKeks",
|
||||||
"WasserToast",
|
"WasserToast",
|
||||||
"MenschSalat",
|
"MenschSalat",
|
||||||
"KampfKohlenhydrate",
|
"KampfKohl",
|
||||||
"SockenZirkus",
|
"SockenZirkus",
|
||||||
"SchwimmBärchen",
|
"SchwimmBärchen",
|
||||||
"TanzenderDachgepäckträger",
|
"TanzenderPudel",
|
||||||
"PizzamarktMensch",
|
"PizzamarktMensch",
|
||||||
"ZahnarztZocker",
|
"ZahnarztZocker",
|
||||||
"RollerCoasterTester",
|
"RollerRudi",
|
||||||
"WaschmaschinenPilot",
|
"PupsPilot",
|
||||||
"WitzigeZwiebel",
|
"WitzigeZwiebel",
|
||||||
"Pillenschlucker",
|
"Pillenschlucker",
|
||||||
"ZwiebelReiter",
|
"ZwiebelReiter",
|
||||||
"HüpfenderKaktus",
|
"HüpfenderKaktus",
|
||||||
"KochenderAsteroid",
|
"AsteroidenAlf",
|
||||||
"ChaosKarotte",
|
"ChaosKarotte",
|
||||||
"WolkenFurz",
|
"WolkenFurz",
|
||||||
"SchnitzelPartikel",
|
"Krümelmonster",
|
||||||
"WackelBiene",
|
"WackelBiene",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user