diff --git a/src/assets/audio/mixxxer.gd b/src/assets/audio/mixxxer.gd index 03537c2..4478af3 100644 --- a/src/assets/audio/mixxxer.gd +++ b/src/assets/audio/mixxxer.gd @@ -2,11 +2,11 @@ tool extends Node enum themes{ - NONE, - BASE, - THEME_1, - THEME_2, - THEME_3, + NONE, + BASE, + THEME_1, + THEME_2, + THEME_3, } export (themes) var current_theme: int = themes.BASE setget set_theme @@ -18,41 +18,41 @@ var transition_state:float = 1 var max_volume = 0.5 func _ready(): - for i in range(themes.size()): - if i > 0: - AudioServer.set_bus_volume_db(i, linear2db(0)) - AudioServer.set_bus_mute(i, true) - if not current_theme == 0: - AudioServer.set_bus_volume_db(current_theme, linear2db(max_volume)) - AudioServer.set_bus_mute(current_theme, false) - if autoplay and not playing: - set_playing(true) + for i in range(themes.size()): + if i > 0: + AudioServer.set_bus_volume_db(i, linear2db(0)) + AudioServer.set_bus_mute(i, true) + if not current_theme == 0: + AudioServer.set_bus_volume_db(current_theme, linear2db(max_volume)) + AudioServer.set_bus_mute(current_theme, false) + if autoplay and not playing: + set_playing(true) func _process(delta): - if last_theme != -1: - transition_state += delta/transition_time - if transition_state > 1: - transition_state = 1 - if not last_theme == 0: AudioServer.set_bus_mute(last_theme, true) - last_theme = -1 - if not current_theme == 0: AudioServer.set_bus_volume_db(current_theme, linear2db(transition_state*max_volume)) - if not last_theme == 0: AudioServer.set_bus_volume_db(last_theme, linear2db((1-transition_state)*max_volume)) - + if last_theme != -1: + transition_state += delta/transition_time + if transition_state > 1: + transition_state = 1 + if not last_theme == 0: AudioServer.set_bus_mute(last_theme, true) + last_theme = -1 + if not current_theme == 0: AudioServer.set_bus_volume_db(current_theme, linear2db(transition_state*max_volume)) + if not last_theme == 0: AudioServer.set_bus_volume_db(last_theme, linear2db((1-transition_state)*max_volume)) + func set_theme(new_theme): - if last_theme == -1: - last_theme = current_theme - current_theme = new_theme - AudioServer.set_bus_mute(new_theme, false) - transition_state = 0 + if last_theme == -1: + last_theme = current_theme + current_theme = new_theme + AudioServer.set_bus_mute(new_theme, false) + transition_state = 0 func set_playing(play_input): - if is_inside_tree(): - $Base.playing = play_input - $Theme1.playing = play_input - $Theme2.playing = play_input - $Theme3.playing = play_input - playing = play_input + if is_inside_tree(): + $Base.playing = play_input + $Theme1.playing = play_input + $Theme2.playing = play_input + $Theme3.playing = play_input + playing = play_input # Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/src/base_scenes/youth_room.tscn b/src/base_scenes/youth_room.tscn index 611c1ed..08afca8 100644 --- a/src/base_scenes/youth_room.tscn +++ b/src/base_scenes/youth_room.tscn @@ -515,7 +515,6 @@ unit_size = 10.0 [node name="theme switcher" type="Node" parent="."] script = ExtResource( 5 ) -current_theme = 2 [node name="Base" type="AudioStreamPlayer" parent="theme switcher"] stream = ExtResource( 8 ) diff --git a/src/default_bus_layout.tres b/src/default_bus_layout.tres index 4998ef3..a85602e 100644 --- a/src/default_bus_layout.tres +++ b/src/default_bus_layout.tres @@ -3,15 +3,15 @@ [resource] bus/1/name = "base" bus/1/solo = false -bus/1/mute = true +bus/1/mute = false bus/1/bypass_fx = false -bus/1/volume_db = -67.9895 +bus/1/volume_db = -6.0206 bus/1/send = "Master" bus/2/name = "theme 1" bus/2/solo = false -bus/2/mute = false +bus/2/mute = true bus/2/bypass_fx = false -bus/2/volume_db = -6.0206 +bus/2/volume_db = inf_neg bus/2/send = "Master" bus/3/name = "theme 2" bus/3/solo = false @@ -25,9 +25,15 @@ bus/4/mute = true bus/4/bypass_fx = false bus/4/volume_db = inf_neg bus/4/send = "Master" -bus/5/name = "gewitter" +bus/5/name = "inside" bus/5/solo = false bus/5/mute = false bus/5/bypass_fx = false -bus/5/volume_db = -6.57885 +bus/5/volume_db = -2.71024 bus/5/send = "Master" +bus/6/name = "outside" +bus/6/solo = false +bus/6/mute = false +bus/6/bypass_fx = false +bus/6/volume_db = 0.0 +bus/6/send = "Master"