diff --git a/common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg b/common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg new file mode 100644 index 0000000..beb08d2 Binary files /dev/null and b/common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg differ diff --git a/common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg.import b/common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg.import new file mode 100644 index 0000000..f39a6bf --- /dev/null +++ b/common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://dyv128cll6e15" +path="res://.godot/imported/ambiance_astra.ogg-c1e9bdfc0ebfa9518b0518ec57815251.oggvorbisstr" + +[deps] + +source_file="res://common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg" +dest_files=["res://.godot/imported/ambiance_astra.ogg-c1e9bdfc0ebfa9518b0518ec57815251.oggvorbisstr"] + +[params] + +loop=true +loop_offset=0 +bpm=0 +beat_count=0 +bar_beats=4 diff --git a/common/audio_manager/audio_manager.tscn b/common/audio_manager/audio_manager.tscn index 0b3a307..5d51504 100644 --- a/common/audio_manager/audio_manager.tscn +++ b/common/audio_manager/audio_manager.tscn @@ -5,7 +5,9 @@ [ext_resource type="AudioStream" uid="uid://bm0tdi6bd2e65" path="res://common/audio_manager/assets/ambiance/niveau/ambiance_phase_2.ogg" id="3_7uv4r"] [ext_resource type="AudioStream" uid="uid://b1hut6lc1jevh" path="res://common/audio_manager/assets/morceaux/niveau/mines_phase_2.ogg" id="4_2fduo"] [ext_resource type="AudioStream" uid="uid://dftxjfdqgsbd3" path="res://common/audio_manager/assets/ambiance/niveau/ambiance_phase_3.ogg" id="4_tuvql"] +[ext_resource type="AudioStream" uid="uid://dyv128cll6e15" path="res://common/audio_manager/assets/ambiance/astra/ambiance_astra.ogg" id="5_8204s"] [ext_resource type="AudioStream" uid="uid://dcbuhtc085q2x" path="res://common/audio_manager/assets/morceaux/niveau/mines_phase_1.ogg" id="5_ajci6"] +[ext_resource type="AudioStream" uid="uid://cwu71o0sl2vto" path="res://common/audio_manager/assets/ambiance/dialogues/ambiance_Demeter.ogg" id="6_8204s"] [ext_resource type="AudioStream" uid="uid://bpf6witukorka" path="res://common/audio_manager/assets/morceaux/menu/main_menu.ogg" id="7_tuvql"] [ext_resource type="AudioStream" uid="uid://dadg6o6dl2k6t" path="res://common/audio_manager/assets/ambiance/vaisseau/ship_music.ogg" id="8_tuvql"] [ext_resource type="AudioStream" uid="uid://dfrp66a4isnt6" path="res://common/audio_manager/assets/sfx/dig/dig_1.wav" id="9_gv65y"] @@ -72,6 +74,14 @@ unique_name_in_owner = true unique_name_in_owner = true stream = SubResource("AudioStreamPlaylist_8204s") +[node name="Astra" type="AudioStreamPlayer" parent="Ambiance" unique_id=1244577212] +unique_name_in_owner = true +stream = ExtResource("5_8204s") + +[node name="Demeter" type="AudioStreamPlayer" parent="Ambiance" unique_id=351918026] +unique_name_in_owner = true +stream = ExtResource("6_8204s") + [node name="Musics" type="Node" parent="." unique_id=1450527710] unique_name_in_owner = true diff --git a/common/audio_manager/scripts/audio_manager.gd b/common/audio_manager/scripts/audio_manager.gd index 2ce7144..a5debfb 100644 --- a/common/audio_manager/scripts/audio_manager.gd +++ b/common/audio_manager/scripts/audio_manager.gd @@ -13,119 +13,132 @@ const MAX_VOLUME = 24. var default_volumes := {} func _ready(): - for player in get_all_players(): - player.stop() - - fetch_default_volumes() - setup_volume() - settings.sound_changed.connect( - func(_s) : setup_volume() - ) - SceneManager.scene_loaded.connect(_on_change_scene) - Dialogic.timeline_started.connect(_on_timeline_started) + for player in get_all_players(): + player.stop() + + fetch_default_volumes() + setup_volume() + settings.sound_changed.connect( + func(_s) : setup_volume() + ) + SceneManager.scene_loaded.connect(_on_change_scene) + Dialogic.timeline_started.connect(_on_timeline_started) func _on_change_scene(scene : Scene): - play_ambiance() + play_ambiance() - match scene.scene_id: - "TITLE": - play_music("Title") - "REGION": - play_music("Region") - play_ambiance("Exterior") - "COCKPIT": - play_music("Ship") + match scene.scene_id: + "TITLE": + play_music("Title") + "REGION": + play_music("Region") + play_ambiance("Exterior") + "COCKPIT": + play_music("Ship") + "ASTRA_BASE": + play_ambiance("Astra") func _on_timeline_started(): - var timeline_name = Dialogic.current_timeline.resource_path.split("/")[-1].trim_suffix(".dtl") - # Timeline name et le nom du fichier de timeline, par exemple demeter_intro - # Amuse toi Niels ;) + var timeline_name = Dialogic.current_timeline.resource_path.split("/")[-1].trim_suffix(".dtl") + play_ambiance() + + match timeline_name: + "demeter_intro": + play_ambiance("Demeter") + "demeter_midrun": + play_ambiance("Demeter") + "demeter_outro": + play_ambiance("Demeter") + "failure": + play_ambiance("Demeter") + # Timeline name et le nom du fichier de timeline, par exemple demeter_intro + # Amuse toi Niels ;) func fetch_default_volumes(): - var all_players := get_all_players() + var all_players := get_all_players() - for player in all_players: - default_volumes[player] = player.volume_db + for player in all_players: + default_volumes[player] = player.volume_db func setup_volume(): - for player in get_all_players(): - player.volume_db = get_volume_from_parent(player) + for player in get_all_players(): + player.volume_db = get_volume_from_parent(player) func get_volume_from_parent(player : AudioStreamPlayer) -> float: - var settings_volume = 0.5 + var settings_volume = 0.5 - if player.get_parent() == %Ambiance: - settings_volume = settings.ambiance_volume - elif player.get_parent() == %Sfx: - settings_volume = settings.sfx_volume - elif player.get_parent() == %Musics: - settings_volume = settings.music_volume - - return default_volumes[player] + lerp(MIN_VOLUME, MAX_VOLUME, settings_volume) + if player.get_parent() == %Ambiance: + settings_volume = settings.ambiance_volume + elif player.get_parent() == %Sfx: + settings_volume = settings.sfx_volume + elif player.get_parent() == %Musics: + settings_volume = settings.music_volume + + return default_volumes[player] + lerp(MIN_VOLUME, MAX_VOLUME, settings_volume) func get_all_players() -> Array[AudioStreamPlayer]: - var players : Array[AudioStreamPlayer] = [] - players.append_array(get_players_from_node(%Musics)) - players.append_array(get_players_from_node(%Ambiance)) - players.append_array(get_players_from_node(%Sfx)) + var players : Array[AudioStreamPlayer] = [] + players.append_array(get_players_from_node(%Musics)) + players.append_array(get_players_from_node(%Ambiance)) + players.append_array(get_players_from_node(%Sfx)) - return players + return players func get_players_from_node(node : Node) -> Array[AudioStreamPlayer]: - var streams : Array[AudioStreamPlayer] = [] + var streams : Array[AudioStreamPlayer] = [] - for c in node.get_children(): - if c is AudioStreamPlayer: - streams.append(c) - return streams + for c in node.get_children(): + if c is AudioStreamPlayer: + streams.append(c) + return streams func set_volume(player : AudioStreamPlayer, to : float, fade_time = default_fade_time) -> Tween: - var fade_tween : Tween = get_tree().create_tween() + var fade_tween : Tween = get_tree().create_tween() - fade_tween.tween_property(player, "volume_db", to, fade_time) + fade_tween.tween_property(player, "volume_db", to, fade_time) - return fade_tween + return fade_tween func reset_volume(player : AudioStreamPlayer): - player.volume_db = get_volume_from_parent(player) + player.volume_db = get_volume_from_parent(player) func play_sfx(sfx_name : String): - var player := %Sfx.find_child(sfx_name) as AudioStreamPlayer - if player: - player.play() - else: - printerr("Sfx %s not found" % sfx_name) + var player := %Sfx.find_child(sfx_name) as AudioStreamPlayer + if player: + player.play() + else: + printerr("Sfx %s not found" % sfx_name) func play_music(music_name : String = ""): - var old_music = playing_music - playing_music = null - if old_music: - await set_volume(old_music, MIN_VOLUME).finished - if old_music and old_music != playing_music: - old_music.stop() - reset_volume(old_music) - if music_name: - var player := %Musics.find_child(music_name) as AudioStreamPlayer - if player: - playing_music = player - player.play() - set_volume(player, get_volume_from_parent(player)) - else: - printerr("Music %s not found" % music_name) + var old_music = playing_music + playing_music = null + if old_music: + await set_volume(old_music, MIN_VOLUME).finished + if old_music and old_music != playing_music: + old_music.stop() + reset_volume(old_music) + if music_name: + var player := %Musics.find_child(music_name) as AudioStreamPlayer + if player: + playing_music = player + player.play() + set_volume(player, get_volume_from_parent(player)) + else: + printerr("Music %s not found" % music_name) func play_ambiance(ambiance_name : String = ""): - var old_ambiance = playing_ambiance - playing_ambiance = null - if old_ambiance: - await set_volume(old_ambiance, MIN_VOLUME).finished - if old_ambiance and old_ambiance != playing_ambiance: - old_ambiance.stop() - reset_volume(old_ambiance) - if ambiance_name: - var player := %Ambiance.find_child(ambiance_name) as AudioStreamPlayer - if player: - playing_ambiance = player - player.play() - set_volume(player, get_volume_from_parent(player)) - else: - printerr("Ambiance %s not found" % ambiance_name) + var old_ambiance = playing_ambiance + playing_ambiance = null + if old_ambiance: + await set_volume(old_ambiance, MIN_VOLUME).finished + if old_ambiance and old_ambiance != playing_ambiance: + old_ambiance.stop() + reset_volume(old_ambiance) + if ambiance_name: + var player := %Ambiance.find_child(ambiance_name) as AudioStreamPlayer + if player: + playing_ambiance = player + player.play() + set_volume(player, get_volume_from_parent(player)) + else: + printerr("Ambiance %s not found" % ambiance_name) diff --git a/dialogs/timelines/gameplay_related/failure.dtl b/dialogs/timelines/gameplay_related/failure.dtl index a6eab4b..d2b3db4 100644 --- a/dialogs/timelines/gameplay_related/failure.dtl +++ b/dialogs/timelines/gameplay_related/failure.dtl @@ -1,6 +1,5 @@ audio "res://common/audio_manager/assets/sfx/dialogs/sfx/incoming_transmission.wav" [wait time="1.5"] -audio music "res://common/audio_manager/assets/ambiance/dialogues/ambiance_Demeter.ogg" [loop="true"] join demeter center [animation="Bounce In"] demeter: [color=#FFA617]{orchidName}[/color] ? demeter: The [color=#FFA617]Internode[/color] sensors are deactivated,[pause=0.2] I am losing connection with you. diff --git a/dialogs/timelines/story/demeter_intro.dtl b/dialogs/timelines/story/demeter_intro.dtl index ef0e6c3..b1d62fd 100644 --- a/dialogs/timelines/story/demeter_intro.dtl +++ b/dialogs/timelines/story/demeter_intro.dtl @@ -3,7 +3,6 @@ [pause=0.5][i]Suddenly, [rainbow]a spark[/rainbow]. [pause=0.5]A thousand of connections blow up as a fireworks scene. A massive amount of data to treat. In these data,[pause=0.3] a video.[/i] #id:13 audio "res://common/audio_manager/assets/sfx/dialogs/sfx/incoming_transmission.wav" [volume="-1.0"] [wait time="1.5"] -audio music "res://common/audio_manager/assets/ambiance/dialogues/ambiance_Demeter.ogg" [loop="true"] join mysterious_demeter center [animation="Bounce In" length="1.0"] [i]It's dark.[pause=0.5] A figure is standing in front of you.[pause=0.5] It is big,[pause=0.3] though weirdly it is not impressive but almost[pause=0.2] reassuring.[/i] #id:14 mysterious_demeter: Hi ! #id:15 diff --git a/dialogs/timelines/story/demeter_midrun.dtl b/dialogs/timelines/story/demeter_midrun.dtl index bd24fc3..4cc5625 100644 --- a/dialogs/timelines/story/demeter_midrun.dtl +++ b/dialogs/timelines/story/demeter_midrun.dtl @@ -1,6 +1,5 @@ audio "res://common/audio_manager/assets/sfx/dialogs/sfx/incoming_transmission.wav" [wait time="1.5"] -audio music "res://common/audio_manager/assets/ambiance/dialogues/ambiance_Demeter.ogg" [loop="true"] join demeter center [animation="Bounce In" length="1.0"] mysterious_demeter: Well done [color=#FFA617]{orchidName}[/color] ! mysterious_demeter: You generated enough [b]plants points[/b] to refill the [color=#FFA617]Internode's[/color] engines. diff --git a/dialogs/timelines/story/demeter_outro.dtl b/dialogs/timelines/story/demeter_outro.dtl index 92c9658..5ecefbb 100644 --- a/dialogs/timelines/story/demeter_outro.dtl +++ b/dialogs/timelines/story/demeter_outro.dtl @@ -1,6 +1,5 @@ audio "res://common/audio_manager/assets/sfx/dialogs/sfx/incoming_transmission.wav" [wait time="1.5"] -audio music "res://common/audio_manager/assets/ambiance/dialogues/ambiance_Demeter.ogg" [loop="true"] join demeter center [animation="Bounce In" length="1.0"] demeter: Welcome to the [color=#E30022]Astra Base[/color] [color=#FFA617]{orchidName}[/color],[pause=0.2] it is the first step of your journey on this planet. - Yes ! What is next ?