add volume settings
This commit is contained in:
parent
5f70784392
commit
4c491e2b3e
@ -58,6 +58,20 @@ const CONFIG_PATH := "user://settings.cfg"
|
|||||||
ui_scale = value
|
ui_scale = value
|
||||||
|
|
||||||
@export_group("Audio")
|
@export_group("Audio")
|
||||||
|
@export var master_volume: float = 0.25:
|
||||||
|
set(value):
|
||||||
|
AudioServer.set_bus_volume_db(_master_bus_index, _better_linear_to_db(value))
|
||||||
|
master_volume = value
|
||||||
|
|
||||||
|
@export var sfx_volume: float = 1:
|
||||||
|
set(value):
|
||||||
|
AudioServer.set_bus_volume_db(_sfx_bus_index, _better_linear_to_db(value))
|
||||||
|
sfx_volume = value
|
||||||
|
|
||||||
|
@export var music_volume: float = 1:
|
||||||
|
set(value):
|
||||||
|
AudioServer.set_bus_volume_db(_music_bus_index, _better_linear_to_db(value))
|
||||||
|
music_volume = value
|
||||||
|
|
||||||
@export_group("Controls")
|
@export_group("Controls")
|
||||||
@export_subgroup("KB & Mouse")
|
@export_subgroup("KB & Mouse")
|
||||||
@ -67,6 +81,9 @@ const CONFIG_PATH := "user://settings.cfg"
|
|||||||
@export var aiming_stick_deadzone: float = 0.5
|
@export var aiming_stick_deadzone: float = 0.5
|
||||||
|
|
||||||
var _default_values: Dictionary = {}
|
var _default_values: Dictionary = {}
|
||||||
|
var _master_bus_index := AudioServer.get_bus_index("Master")
|
||||||
|
var _sfx_bus_index := AudioServer.get_bus_index("SFX")
|
||||||
|
var _music_bus_index := AudioServer.get_bus_index("Music")
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
func _init() -> void:
|
||||||
@ -153,3 +170,7 @@ func _property_is_setting(property: Dictionary) -> bool:
|
|||||||
|
|
||||||
func _property_is_section(property: Dictionary) -> bool:
|
func _property_is_section(property: Dictionary) -> bool:
|
||||||
return property["usage"] == PROPERTY_USAGE_GROUP
|
return property["usage"] == PROPERTY_USAGE_GROUP
|
||||||
|
|
||||||
|
|
||||||
|
func _better_linear_to_db(lin: float) -> float:
|
||||||
|
return linear_to_db(lin * lin * lin)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user