extends HSlider

export(String) var audio_bus := "Master"
onready var _bus := AudioServer.get_bus_index(audio_bus)
onready var bus_resource_path := "res://src/Sounds/default_bus_layout.tres"

func _ready() -> void:
    min_value = 0.0
    max_value = 1.0
    step = 0.01
    self.connect("value_changed", self, "_on_Slider_value_changed")
    value = db2linear(AudioServer.get_bus_volume_db(_bus))
    $Label.text = str(value*100)

func _on_Slider_value_changed(value: float) -> void:
    AudioServer.set_bus_volume_db(_bus, linear2db(value))
    $Label.text = str(value*100)
    
