1
0
mirror of https://github.com/JohnBreaux/Boat-Battle.git synced 2024-11-14 21:15:58 +00:00

Sounds no longer scale linearly

This commit is contained in:
hpham474 2021-11-14 00:30:18 -06:00
parent d99419901f
commit 223f36ffdd
4 changed files with 19 additions and 16 deletions

View File

@ -26,12 +26,15 @@ bus = "SFX"
[node name="shipHitSFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 4 )
volume_db = -10.0
bus = "SFX"
[node name="shipMissedSFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 5 )
volume_db = -5.0
bus = "SFX"
[node name="shipSunkSFX" type="AudioStreamPlayer" parent="."]
stream = ExtResource( 6 )
volume_db = -10.0
bus = "SFX"

View File

@ -58,10 +58,9 @@ focus_neighbour_top = NodePath("../../../Back")
focus_neighbour_bottom = NodePath("../../Volume Setting/Volume Slider")
focus_next = NodePath("../../Volume Setting/Volume Slider")
focus_previous = NodePath("../../../Back")
min_value = -25.0
max_value = 0.0
max_value = 1.0
step = 0.05
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}
@ -90,10 +89,9 @@ focus_neighbour_top = NodePath("../../SFX Setting/SFX Slider")
focus_neighbour_bottom = NodePath("../../../Buttons/Dark")
focus_next = NodePath("../../../Buttons/Dark")
focus_previous = NodePath("../../SFX Setting/SFX Slider")
min_value = -50.0
max_value = 0.0
max_value = 1.0
step = 0.05
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}
@ -117,10 +115,9 @@ margin_left = 64.0
margin_top = 48.0
margin_right = 208.0
margin_bottom = 64.0
min_value = -50.0
max_value = 0.0
max_value = 1.0
step = 0.05
tick_count = 10
ticks_on_borders = true
__meta__ = {
"_edit_use_anchors_": false
}

View File

@ -10,9 +10,9 @@ onready var theme_buttons = find_node("Buttons", true, true).get_children()
func _ready():
OptionsController.load_options()
find_next_valid_focus().grab_focus()
master_slider.value = OptionsController.get_mas_volume()
music_slider.value = OptionsController.get_mus_volume()
sound_slider.value = OptionsController.get_sfx_volume()
master_slider.value = db2linear(OptionsController.get_mas_volume())
music_slider.value = db2linear(OptionsController.get_mus_volume())
sound_slider.value = db2linear(OptionsController.get_sfx_volume())
func _on_Button_pressed():
AudioBus.emit_signal("button_clicked")
@ -20,14 +20,17 @@ func _on_Button_pressed():
#MessageBus.emit_signal("change_scene", "Title")
func _on_Master_Slider_value_changed(value):
value = linear2db(value)
AudioBus.emit_signal("button_clicked")
OptionsController.set_vol(value, "mas_vol")
func _on_Music_Slider_value_changed(value):
value = linear2db(value)
AudioBus.emit_signal("button_clicked")
OptionsController.set_vol(value, "mus_vol")
func _on_SFX_Slider_value_changed(value):
value = linear2db(value)
AudioBus.emit_signal("button_clicked")
OptionsController.set_vol(value, "sfx_vol")

View File

@ -8,9 +8,9 @@ signal change_theme (theme)
var f = File.new()
var options_file = "user://options.save"
var theme = "dark"
var mas_vol = 0
var mus_vol = 0
var sfx_vol = 0
var mas_vol = linear2db(1)
var mus_vol = linear2db(1)
var sfx_vol = linear2db(1)
func _ready():
load_options()
@ -62,7 +62,7 @@ func load_options():
mus_vol = f.get_var()
sfx_vol = f.get_var()
f.close()
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), mus_vol)
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), mas_vol)
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("BGM"), mus_vol)
AudioServer.set_bus_volume_db(AudioServer.get_bus_index("SFX"), sfx_vol)