sound on memory wip

This commit is contained in:
minjaesong
2024-04-02 00:29:59 +09:00
parent a1a70274dd
commit 53f54a450d
6 changed files with 100 additions and 29 deletions

View File

@@ -554,9 +554,9 @@ public class App implements ApplicationListener {
CommonResourcePool.INSTANCE.addToLoadingList("title_health1", () -> new Texture(Gdx.files.internal("./assets/graphics/gui/health_take_a_break.tga")));
CommonResourcePool.INSTANCE.addToLoadingList("title_health2", () -> new Texture(Gdx.files.internal("./assets/graphics/gui/health_distance.tga")));
CommonResourcePool.INSTANCE.addToLoadingList("sound:haptic_bop", () -> new MusicContainer("haptic_bop", Gdx.files.internal("./assets/audio/effects/haptic_bop.ogg").file(), false, (Music m) -> { return null; }));
CommonResourcePool.INSTANCE.addToLoadingList("sound:haptic_bup", () -> new MusicContainer("haptic_bup", Gdx.files.internal("./assets/audio/effects/haptic_bup.ogg").file(), false, (Music m) -> { return null; }));
CommonResourcePool.INSTANCE.addToLoadingList("sound:haptic_bip", () -> new MusicContainer("haptic_bip", Gdx.files.internal("./assets/audio/effects/haptic_bip.ogg").file(), false, (Music m) -> { highPrioritySoundPlaying = false; return null; }));
CommonResourcePool.INSTANCE.addToLoadingList("sound:haptic_bop", () -> new MusicContainer(true, "haptic_bop", Gdx.files.internal("./assets/audio/effects/haptic_bop.ogg").file(), false, (Music m) -> { return null; }));
CommonResourcePool.INSTANCE.addToLoadingList("sound:haptic_bup", () -> new MusicContainer(true, "haptic_bup", Gdx.files.internal("./assets/audio/effects/haptic_bup.ogg").file(), false, (Music m) -> { return null; }));
CommonResourcePool.INSTANCE.addToLoadingList("sound:haptic_bip", () -> new MusicContainer(true, "haptic_bip", Gdx.files.internal("./assets/audio/effects/haptic_bip.ogg").file(), false, (Music m) -> { highPrioritySoundPlaying = false; return null; }));
// make loading list
CommonResourcePool.INSTANCE.loadAll();
@@ -1971,13 +1971,15 @@ public class App implements ApplicationListener {
public static void playGUIsound(MusicContainer sound, double volume, float pan) {
if (!highPrioritySoundPlaying) {
var it = audioMixer.getGuiTrack();
it.stop();
it.setCurrentTrack(sound);
it.setMaxVolumeFun(() -> volume);
it.setVolume(volume);
((BinoPan) it.getFilters()[1]).setPan(pan);
it.play();
var it = audioMixer.getFreeGuiTrackNoMatterWhat();
if (it != null) {
it.stop();
it.setCurrentTrack(sound);
it.setMaxVolumeFun(() -> volume);
it.setVolume(volume);
((BinoPan) it.getFilters()[0]).setPan(pan);
it.play();
}
}
}
public static void playGUIsound(MusicContainer sound, double volume) { playGUIsound(sound, volume, 0.0f); }
@@ -1985,13 +1987,13 @@ public class App implements ApplicationListener {
public static void playGUIsoundHigh(MusicContainer sound, double volume, float pan) {
// TODO when a sound is played thru this function, other sound play calls thru playGUIsound are ignored until this sound finishes playing
var it = audioMixer.getGuiTrack();
var it = audioMixer.getFreeGuiTrackNoMatterWhat();
highPrioritySoundPlaying = true;
it.stop();
it.setCurrentTrack(sound);
it.setMaxVolumeFun(() -> volume);
it.setVolume(volume);
((BinoPan) it.getFilters()[1]).setPan(pan);
((BinoPan) it.getFilters()[0]).setPan(pan);
it.play();
}
public static void playGUIsoundHigh(MusicContainer sound, double volume) { playGUIsoundHigh(sound, volume, 0.0f); }