From b3fff0134f5d82518e473b1725bb60658a7fb477 Mon Sep 17 00:00:00 2001 From: Sen Date: Tue, 18 Mar 2025 13:07:23 +0100 Subject: [PATCH] sounds --- java/src/game/Game.java | 2 +- java/src/game/gui/GuiSound.java | 4 ++-- java/src/game/gui/element/Dropdown.java | 3 +++ java/src/game/gui/element/Slider.java | 2 ++ java/src/game/gui/element/Switch.java | 1 + java/src/game/gui/element/Toggle.java | 1 + 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/java/src/game/Game.java b/java/src/game/Game.java index 12afd8d..3f6fa89 100755 --- a/java/src/game/Game.java +++ b/java/src/game/Game.java @@ -375,7 +375,7 @@ public class Game implements IThreadListener { public int port = Config.PORT; public int bind = -1; - @Variable(name = "snd_device_type", category = CVarCategory.SOUND, display = "Tonausgabe") + @Variable(name = "snd_enabled", category = CVarCategory.SOUND, display = "Tonausgabe") public boolean soundEnabled = true; @Variable(name = "snd_buffer_size", category = CVarCategory.SOUND, min = 0, max = 1048576, display = "Puffergröße") public int soundBufferSize = 2048; diff --git a/java/src/game/gui/GuiSound.java b/java/src/game/gui/GuiSound.java index b0bfab5..515142c 100644 --- a/java/src/game/gui/GuiSound.java +++ b/java/src/game/gui/GuiSound.java @@ -20,7 +20,7 @@ public class GuiSound extends GuiOptions { // gui_add_custom(win, 30, 240, 128, 128, gui_render_velocity); - this.addSelector("snd_device_type", 490, 260, 440, 24); + this.addSelector("snd_enabled", 30, 380, 440, 24); // this.addSelector("snd_sample_rate", 30, 380, 440, 24); // this.addSelector("snd_sample_format", 490, 380, 440, 24); @@ -35,7 +35,7 @@ public class GuiSound extends GuiOptions { }, "Übernehmen und Audio-Thread neu starten")); int x = 30; - int y = 540; + int y = 220; for(Volume volume : Volume.values()) { this.addSelector(volume.getCVarName(), x, y, 440, 24); x = (x == 30) ? 490 : 30; diff --git a/java/src/game/gui/element/Dropdown.java b/java/src/game/gui/element/Dropdown.java index a5c4ebf..159a90f 100644 --- a/java/src/game/gui/element/Dropdown.java +++ b/java/src/game/gui/element/Dropdown.java @@ -51,6 +51,7 @@ public class Dropdown extends Element { if(drop.value != prev) { drop.func.use(drop, drop.getValue()); drop.formatText(); + this.playSound(); } this.visible = false; this.r_dirty = true; @@ -110,6 +111,7 @@ public class Dropdown extends Element { if((this.value = this.def) != prev) { this.func.use(this, this.getValue()); this.formatText(); + this.playSound(); } } else if(this.gui != null) { @@ -117,6 +119,7 @@ public class Dropdown extends Element { drop.visible = true; drop.r_dirty = true; this.gui.selected = drop; + this.playSound(); } } diff --git a/java/src/game/gui/element/Slider.java b/java/src/game/gui/element/Slider.java index e0a84f8..8c9114a 100644 --- a/java/src/game/gui/element/Slider.java +++ b/java/src/game/gui/element/Slider.java @@ -97,6 +97,7 @@ public class Slider extends Element { if(this.value != prev) { this.func.use(this, this.value); this.formatText(); + this.playSound(); } } else { @@ -106,6 +107,7 @@ public class Slider extends Element { if(this.value != prev) { this.func.use(this, this.value); this.formatText(); + this.playSound(); } } } diff --git a/java/src/game/gui/element/Switch.java b/java/src/game/gui/element/Switch.java index 9115632..77249c2 100644 --- a/java/src/game/gui/element/Switch.java +++ b/java/src/game/gui/element/Switch.java @@ -49,6 +49,7 @@ public class Switch extends Element { if(this.value != prev) { this.func.use(this, this.getValue()); this.formatText(); + this.playSound(); } } } diff --git a/java/src/game/gui/element/Toggle.java b/java/src/game/gui/element/Toggle.java index c2df8f8..604d513 100644 --- a/java/src/game/gui/element/Toggle.java +++ b/java/src/game/gui/element/Toggle.java @@ -39,6 +39,7 @@ public class Toggle extends Element { this.r_dirty = true; this.func.use(this, this.value); this.formatText(); + this.playSound(); } }