diff --git a/client/ui/settings/Settings.tscn b/client/ui/settings/Settings.tscn index 8d9363d..e0c7675 100644 --- a/client/ui/settings/Settings.tscn +++ b/client/ui/settings/Settings.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://bqpbrju7mc7d5"] +[gd_scene load_steps=16 format=3 uid="uid://bqpbrju7mc7d5"] [ext_resource type="Script" path="res://ui/settings/Settings.gd" id="1_gx3lf"] [ext_resource type="Script" path="res://ui/label/ParentNameLabel.gd" id="2_72a3s"] @@ -14,6 +14,7 @@ [ext_resource type="Script" path="res://ui/settings/video/Contrast.gd" id="12_5kqj0"] [ext_resource type="Script" path="res://ui/settings/video/Saturation.gd" id="13_ntyeq"] [ext_resource type="Script" path="res://ui/settings/layer/CullMaskToggle.gd" id="14_npk11"] +[ext_resource type="PackedScene" uid="uid://meal8j3ft58r" path="res://ui/settings/audio/AudioBusVolume.tscn" id="14_pvo80"] [node name="Settings" type="Control"] layout_mode = 3 @@ -32,8 +33,10 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +current_tab = 1 [node name="Video" type="MarginContainer" parent="TabContainer"] +visible = false layout_mode = 2 [node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Video"] @@ -248,6 +251,33 @@ step = 0.05 value = 0.5 script = ExtResource("13_ntyeq") +[node name="Audio" type="MarginContainer" parent="TabContainer"] +layout_mode = 2 + +[node name="VBoxContainer" type="VBoxContainer" parent="TabContainer/Audio"] +layout_mode = 2 + +[node name="Master" parent="TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")] +layout_mode = 2 + +[node name="Music" parent="TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")] +layout_mode = 2 + +[node name="Effects" parent="TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")] +layout_mode = 2 + +[node name="Voices" parent="TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")] +layout_mode = 2 + +[node name="Environment" parent="TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")] +layout_mode = 2 + +[node name="Skills" parent="TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")] +layout_mode = 2 + +[node name="Footsteps" parent="TabContainer/Audio/VBoxContainer" instance=ExtResource("14_pvo80")] +layout_mode = 2 + [node name="Layers" type="MarginContainer" parent="TabContainer"] visible = false layout_mode = 2 diff --git a/client/ui/settings/audio/AudioBusVolume.gd b/client/ui/settings/audio/AudioBusVolume.gd new file mode 100644 index 0000000..47d1846 --- /dev/null +++ b/client/ui/settings/audio/AudioBusVolume.gd @@ -0,0 +1,21 @@ +@tool +extends Slider + +var bus := -1 + +func _ready(): + bus = AudioServer.get_bus_index(get_parent().name) + var db := AudioServer.get_bus_volume_db(bus) + var linear := db_to_linear(db) + set_value_no_signal(linear) + +func on_value_changed(new_value: float): + AudioServer.set_bus_volume_db(bus, linear_to_db(new_value)) + +func _get_configuration_warnings() -> PackedStringArray: + var warnings := [] + + if AudioServer.get_bus_index(get_parent().name) == -1: + warnings.append("Invalid audio bus name: %s" % get_parent().name) + + return warnings \ No newline at end of file diff --git a/client/ui/settings/audio/AudioBusVolume.tscn b/client/ui/settings/audio/AudioBusVolume.tscn new file mode 100644 index 0000000..7c1aec2 --- /dev/null +++ b/client/ui/settings/audio/AudioBusVolume.tscn @@ -0,0 +1,23 @@ +[gd_scene load_steps=3 format=3 uid="uid://meal8j3ft58r"] + +[ext_resource type="Script" path="res://ui/label/ParentNameLabel.gd" id="1_hrs80"] +[ext_resource type="Script" path="res://ui/settings/audio/AudioBusVolume.gd" id="2_3ihfm"] + +[node name="Master" type="HBoxContainer"] +custom_minimum_size = Vector2(0, 32) + +[node name="Label" type="Label" parent="."] +layout_mode = 2 +size_flags_horizontal = 3 +text = "Master:" +script = ExtResource("1_hrs80") + +[node name="HSlider" type="HSlider" parent="."] +layout_mode = 2 +size_flags_horizontal = 3 +max_value = 1.0 +step = 0.01 +value = 1.0 +script = ExtResource("2_3ihfm") + +[connection signal="value_changed" from="HSlider" to="HSlider" method="on_value_changed"] diff --git a/client/world/AudioBusLayout.tres b/client/world/AudioBusLayout.tres index 5aa7b4e..630e26b 100644 --- a/client/world/AudioBusLayout.tres +++ b/client/world/AudioBusLayout.tres @@ -22,7 +22,7 @@ bus/3/mute = false bus/3/bypass_fx = false bus/3/volume_db = -10.0741 bus/3/send = &"Master" -bus/4/name = &"Ambience" +bus/4/name = &"Environment" bus/4/solo = false bus/4/mute = false bus/4/bypass_fx = false @@ -36,3 +36,9 @@ bus/5/mute = false bus/5/bypass_fx = false bus/5/volume_db = -4.5 bus/5/send = &"Effects" +bus/6/name = &"Skills" +bus/6/solo = false +bus/6/mute = false +bus/6/bypass_fx = false +bus/6/volume_db = 0.0 +bus/6/send = &"Effects"