mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-12 06:41:51 +09:00
sound on memory wip
This commit is contained in:
@@ -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); }
|
||||
|
||||
Reference in New Issue
Block a user