Merge branch 'musique_et_son_2' of https://git.zacharie-guet.fr/zacharie/seeding-planets into musique_et_son_2
This commit is contained in:
@@ -12,8 +12,14 @@ dest_files=["res://.godot/imported/ship_music.ogg-a35a322e3a6a4adafae0f2adcaf212
|
||||
|
||||
[params]
|
||||
|
||||
<<<<<<< HEAD
|
||||
loop=true
|
||||
loop_offset=0.0
|
||||
bpm=0.0
|
||||
=======
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
|
||||
@@ -18,7 +18,7 @@ force/max_rate=false
|
||||
force/max_rate_hz=44100
|
||||
edit/trim=false
|
||||
edit/normalize=false
|
||||
edit/loop_mode=0
|
||||
edit/loop_mode=2
|
||||
edit/loop_begin=0
|
||||
edit/loop_end=-1
|
||||
compress/mode=2
|
||||
|
||||
BIN
common/audio_manager/assets/sfx/signal/signal.mp3
Normal file
BIN
common/audio_manager/assets/sfx/signal/signal.mp3
Normal file
Binary file not shown.
19
common/audio_manager/assets/sfx/signal/signal.mp3.import
Normal file
19
common/audio_manager/assets/sfx/signal/signal.mp3.import
Normal file
@@ -0,0 +1,19 @@
|
||||
[remap]
|
||||
|
||||
importer="mp3"
|
||||
type="AudioStreamMP3"
|
||||
uid="uid://c5y70k3codtn"
|
||||
path="res://.godot/imported/signal.mp3-2f41c9334233d52845bfe384d47f2a96.mp3str"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://common/audio_manager/assets/sfx/signal/signal.mp3"
|
||||
dest_files=["res://.godot/imported/signal.mp3-2f41c9334233d52845bfe384d47f2a96.mp3str"]
|
||||
|
||||
[params]
|
||||
|
||||
loop=false
|
||||
loop_offset=0
|
||||
bpm=0
|
||||
beat_count=0
|
||||
bar_beats=4
|
||||
@@ -5,6 +5,7 @@
|
||||
[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"]
|
||||
<<<<<<< HEAD
|
||||
[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"]
|
||||
@@ -12,13 +13,22 @@
|
||||
[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://dsphn6dbbd55a" path="res://common/audio_manager/assets/morceaux/niveau/forest_phase_1.ogg" id="9_am7i4"]
|
||||
=======
|
||||
[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://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"]
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
[ext_resource type="AudioStream" uid="uid://dfrp66a4isnt6" path="res://common/audio_manager/assets/sfx/dig/dig_1.wav" id="9_gv65y"]
|
||||
[ext_resource type="AudioStream" uid="uid://bdxkvaciw4mb3" path="res://common/audio_manager/assets/sfx/dig/dig_2.wav" id="10_n7o7n"]
|
||||
[ext_resource type="AudioStream" uid="uid://ccimypx71o4g6" path="res://common/audio_manager/assets/morceaux/niveau/forest_phase_2.ogg" id="10_tq535"]
|
||||
[ext_resource type="AudioStream" uid="uid://kqbqhwhkv7o3" path="res://common/audio_manager/assets/morceaux/niveau/mines_waiting.ogg" id="11_ngi21"]
|
||||
[ext_resource type="AudioStream" uid="uid://llxrlwfccywb" path="res://common/audio_manager/assets/sfx/dig/dig_3.wav" id="11_wtvls"]
|
||||
[ext_resource type="AudioStream" uid="uid://b8inedx4yjslw" path="res://common/audio_manager/assets/sfx/drop/drop_1.wav" id="12_4hp8f"]
|
||||
<<<<<<< HEAD
|
||||
[ext_resource type="AudioStream" uid="uid://cjbpfnlwcpjh0" path="res://common/audio_manager/assets/morceaux/niveau/forest_waiting.ogg" id="12_xmumj"]
|
||||
=======
|
||||
[ext_resource type="AudioStream" uid="uid://c5y70k3codtn" path="res://common/audio_manager/assets/sfx/signal/signal.mp3" id="12_ajci6"]
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
[ext_resource type="AudioStream" uid="uid://8nmr5vifkt1f" path="res://common/audio_manager/assets/sfx/harvest/harvest_1.wav" id="13_xoaox"]
|
||||
[ext_resource type="AudioStream" uid="uid://dgkdcq4j6fe3o" path="res://common/audio_manager/assets/sfx/harvest/harvest_2.wav" id="14_b5bgj"]
|
||||
[ext_resource type="AudioStream" uid="uid://eh3dbuxu5qtw" path="res://common/audio_manager/assets/sfx/harvest/harvest_3.wav" id="15_ynvb4"]
|
||||
@@ -29,6 +39,7 @@
|
||||
[ext_resource type="AudioStream" uid="uid://cqa0gvgpoa7pd" path="res://common/audio_manager/assets/sfx/pick_up/pick_up_2.wav" id="21_dk5s6"]
|
||||
[ext_resource type="AudioStream" uid="uid://d1cpi438ep0ys" path="res://common/audio_manager/assets/sfx/announce/annnounce.wav" id="22_btfwx"]
|
||||
[ext_resource type="AudioStream" uid="uid://ccq04ahrwr3bv" path="res://common/audio_manager/assets/sfx/alarm/alarm.wav" id="23_fwu3w"]
|
||||
<<<<<<< HEAD
|
||||
[ext_resource type="AudioStream" uid="uid://b4jx8rflw7dss" path="res://common/audio_manager/assets/sfx/phone/phone_ringing_Astra.wav" id="27_0rjel"]
|
||||
[ext_resource type="AudioStream" uid="uid://ocm1dkkhv7ls" path="res://common/audio_manager/assets/sfx/phone/phone_ringing.wav" id="28_3dfjn"]
|
||||
[ext_resource type="AudioStream" uid="uid://8juy5ev3rdfh" path="res://common/audio_manager/assets/sfx/plant_points/plant_point_1.wav" id="29_ngi21"]
|
||||
@@ -40,6 +51,12 @@
|
||||
[ext_resource type="AudioStream" uid="uid://cad0erjq0us08" path="res://common/audio_manager/assets/sfx/plant_points/plant_point_7.wav" id="35_rk2e0"]
|
||||
[ext_resource type="AudioStream" uid="uid://c6pl2fjg558j3" path="res://common/audio_manager/assets/sfx/plant_points/plant_point_8.wav" id="36_4sa2t"]
|
||||
[ext_resource type="AudioStream" uid="uid://b6lb4kwk7vmr" path="res://common/audio_manager/assets/sfx/ship_reveal/jingle_vaisseau.ogg" id="37_3dfjn"]
|
||||
=======
|
||||
[ext_resource type="AudioStream" uid="uid://ctfaxvblcg5lc" path="res://common/audio_manager/assets/sfx/pickaxe/pickaxe_1.wav" id="24_tq535"]
|
||||
[ext_resource type="AudioStream" uid="uid://c1dnklmka2ccn" path="res://common/audio_manager/assets/sfx/pickaxe/pickaxe_2.wav" id="25_ywn7s"]
|
||||
[ext_resource type="AudioStream" uid="uid://dd1uu6dd6sloe" path="res://common/audio_manager/assets/sfx/pickaxe/pickaxe_3.wav" id="26_xhon7"]
|
||||
[ext_resource type="AudioStream" uid="uid://eq7wufwnolto" path="res://common/audio_manager/assets/sfx/pickaxe/pickaxe_4.wav" id="27_3jg6d"]
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
[sub_resource type="AudioStreamPlaylist" id="AudioStreamPlaylist_8204s"]
|
||||
stream_count = 3
|
||||
@@ -51,10 +68,13 @@ stream_2 = ExtResource("4_tuvql")
|
||||
stream_count = 6
|
||||
stream_0 = ExtResource("5_ajci6")
|
||||
stream_1 = ExtResource("4_2fduo")
|
||||
<<<<<<< HEAD
|
||||
stream_2 = ExtResource("11_ngi21")
|
||||
stream_3 = ExtResource("9_am7i4")
|
||||
stream_4 = ExtResource("10_tq535")
|
||||
stream_5 = ExtResource("12_xmumj")
|
||||
=======
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_kfbah"]
|
||||
streams_count = 3
|
||||
@@ -62,6 +82,11 @@ stream_0/stream = ExtResource("9_gv65y")
|
||||
stream_1/stream = ExtResource("10_n7o7n")
|
||||
stream_2/stream = ExtResource("11_wtvls")
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_8204s"]
|
||||
random_pitch = 1.0594631
|
||||
streams_count = 1
|
||||
stream_0/stream = ExtResource("12_ajci6")
|
||||
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_1w04j"]
|
||||
random_pitch = 1.2
|
||||
streams_count = 1
|
||||
@@ -82,6 +107,7 @@ streams_count = 2
|
||||
stream_0/stream = ExtResource("20_pu6t4")
|
||||
stream_1/stream = ExtResource("21_dk5s6")
|
||||
|
||||
<<<<<<< HEAD
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_qog4c"]
|
||||
random_pitch = 1.2599211
|
||||
streams_count = 8
|
||||
@@ -93,11 +119,19 @@ stream_4/stream = ExtResource("33_w2elg")
|
||||
stream_5/stream = ExtResource("34_em3o8")
|
||||
stream_6/stream = ExtResource("35_rk2e0")
|
||||
stream_7/stream = ExtResource("36_4sa2t")
|
||||
=======
|
||||
[sub_resource type="AudioStreamRandomizer" id="AudioStreamRandomizer_dhq5t"]
|
||||
random_pitch = 1.0594631
|
||||
streams_count = 4
|
||||
stream_0/stream = ExtResource("24_tq535")
|
||||
stream_1/stream = ExtResource("25_ywn7s")
|
||||
stream_2/stream = ExtResource("26_xhon7")
|
||||
stream_3/stream = ExtResource("27_3jg6d")
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
[node name="AudioManager" type="Node" unique_id=1871137180]
|
||||
process_mode = 3
|
||||
script = ExtResource("1_0tvca")
|
||||
default_fade_time = 2.0
|
||||
|
||||
[node name="Ambiance" type="Node" parent="." unique_id=1989991562]
|
||||
unique_name_in_owner = true
|
||||
@@ -105,6 +139,7 @@ unique_name_in_owner = true
|
||||
[node name="Exterior" type="AudioStreamPlayer" parent="Ambiance" unique_id=1405716780]
|
||||
unique_name_in_owner = true
|
||||
stream = SubResource("AudioStreamPlaylist_8204s")
|
||||
<<<<<<< HEAD
|
||||
|
||||
[node name="Astra" type="AudioStreamPlayer" parent="Ambiance" unique_id=1244577212]
|
||||
unique_name_in_owner = true
|
||||
@@ -117,6 +152,8 @@ stream = ExtResource("6_8204s")
|
||||
[node name="Borea" type="AudioStreamPlayer" parent="Ambiance" unique_id=1857904648]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("7_spekb")
|
||||
=======
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
[node name="Musics" type="Node" parent="." unique_id=1450527710]
|
||||
unique_name_in_owner = true
|
||||
@@ -128,6 +165,7 @@ stream = SubResource("AudioStreamPlaylist_ajci6")
|
||||
[node name="Title" type="AudioStreamPlayer" parent="Musics" unique_id=2105759422]
|
||||
unique_name_in_owner = true
|
||||
stream = ExtResource("7_tuvql")
|
||||
bus = &"Music"
|
||||
|
||||
[node name="Ship" type="AudioStreamPlayer" parent="Musics" unique_id=1165150318]
|
||||
unique_name_in_owner = true
|
||||
@@ -140,6 +178,9 @@ unique_name_in_owner = true
|
||||
[node name="Dig" type="AudioStreamPlayer" parent="Sfx" unique_id=486042600]
|
||||
stream = SubResource("AudioStreamRandomizer_kfbah")
|
||||
|
||||
[node name="Signal" type="AudioStreamPlayer" parent="Sfx" unique_id=641246368]
|
||||
stream = SubResource("AudioStreamRandomizer_8204s")
|
||||
|
||||
[node name="Drop" type="AudioStreamPlayer" parent="Sfx" unique_id=1391500830]
|
||||
stream = SubResource("AudioStreamRandomizer_1w04j")
|
||||
|
||||
@@ -157,6 +198,7 @@ volume_db = 8.627
|
||||
[node name="Alarm" type="AudioStreamPlayer" parent="Sfx" unique_id=689347925]
|
||||
stream = ExtResource("23_fwu3w")
|
||||
|
||||
<<<<<<< HEAD
|
||||
[node name="Astra_phone_call" type="AudioStreamPlayer" parent="Sfx" unique_id=721344636]
|
||||
stream = ExtResource("27_0rjel")
|
||||
|
||||
@@ -169,3 +211,7 @@ stream = SubResource("AudioStreamRandomizer_qog4c")
|
||||
[node name="Ship_reveal" type="AudioStreamPlayer" parent="Sfx" unique_id=1121632306]
|
||||
stream = ExtResource("37_3dfjn")
|
||||
volume_db = -10.0
|
||||
=======
|
||||
[node name="Pickaxe" type="AudioStreamPlayer" parent="Sfx" unique_id=996309145]
|
||||
stream = SubResource("AudioStreamRandomizer_dhq5t")
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
@@ -3,16 +3,20 @@ extends Node
|
||||
const MIN_VOLUME = -60.
|
||||
const MAX_VOLUME = 24.
|
||||
|
||||
const DEFAULT_FADE_TIME : float = 0.5
|
||||
|
||||
@onready var settings : SettingsData = GameInfo.settings_data
|
||||
|
||||
@export var default_fade_time = 0.5
|
||||
|
||||
@export var playing_music : AudioStreamPlayer = null
|
||||
@export var playing_ambiance : AudioStreamPlayer = null
|
||||
var music_action : AudioAction
|
||||
var ambiance_action : AudioAction
|
||||
var playing_music : AudioStreamPlayer = null
|
||||
var playing_ambiance : AudioStreamPlayer = null
|
||||
|
||||
var default_volumes := {}
|
||||
|
||||
func _ready():
|
||||
<<<<<<< HEAD
|
||||
for player in get_all_players():
|
||||
player.stop()
|
||||
|
||||
@@ -55,6 +59,117 @@ func _on_timeline_started():
|
||||
play_ambiance("Demeter")
|
||||
# Timeline name et le nom du fichier de timeline, par exemple demeter_intro
|
||||
# Amuse toi Niels ;)
|
||||
=======
|
||||
for player in get_all_players():
|
||||
player.stop()
|
||||
|
||||
fetch_default_volumes()
|
||||
# setup_players_bus()
|
||||
settings.sound_changed.connect(
|
||||
func(_s) : setup_players_bus()
|
||||
)
|
||||
SceneManager.scene_loaded.connect(_on_change_scene)
|
||||
Dialogic.timeline_started.connect(_on_timeline_started)
|
||||
Dialogic.timeline_ended.connect(_on_timeline_ended)
|
||||
|
||||
func _process(_d):
|
||||
if music_action:
|
||||
playing_music = process_audio_action(
|
||||
music_action,
|
||||
%Musics,
|
||||
playing_music
|
||||
)
|
||||
music_action = null
|
||||
|
||||
if ambiance_action:
|
||||
playing_ambiance = process_audio_action(
|
||||
ambiance_action,
|
||||
%Ambiance,
|
||||
playing_ambiance
|
||||
)
|
||||
ambiance_action = null
|
||||
|
||||
func process_audio_action(
|
||||
audio_action : AudioAction,
|
||||
player_search_node: Node,
|
||||
current_player: AudioStreamPlayer = null
|
||||
) -> AudioStreamPlayer:
|
||||
if audio_action is AudioLaunch:
|
||||
return process_audio_launch(audio_action, player_search_node, current_player)
|
||||
elif audio_action is AudioStop and current_player and current_player.playing:
|
||||
stop_player(current_player)
|
||||
|
||||
return null
|
||||
|
||||
func process_audio_launch(
|
||||
audio_launch : AudioLaunch,
|
||||
player_search_node: Node,
|
||||
current_player: AudioStreamPlayer = null,
|
||||
) -> AudioStreamPlayer:
|
||||
var player = player_search_node.find_child(audio_launch.player_name)
|
||||
if not player:
|
||||
printerr("Player %s not found in category %s" % [audio_launch.player_name, player_search_node.name])
|
||||
return null
|
||||
if current_player and current_player.playing and current_player.name == audio_launch.player_name:
|
||||
return current_player
|
||||
elif current_player:
|
||||
stop_player(current_player)
|
||||
|
||||
start_player(player, audio_launch.from_random_time, audio_launch.fade_time)
|
||||
return player
|
||||
|
||||
func _on_change_scene(scene : Scene):
|
||||
stop_ambiance()
|
||||
|
||||
match scene.scene_id:
|
||||
"TITLE":
|
||||
play_music("Title", false, 0.0)
|
||||
"REGION":
|
||||
play_music("Region", true)
|
||||
play_ambiance("Exterior", true)
|
||||
"COCKPIT":
|
||||
play_music("Ship")
|
||||
|
||||
func _on_timeline_started():
|
||||
var timeline_name = Dialogic.current_timeline.resource_path.split("/")[-1].trim_suffix(".dtl")
|
||||
play_ambiance()
|
||||
|
||||
match timeline_name:
|
||||
"demeter_intro":
|
||||
play_ambiance("Demeter")
|
||||
"demeter_introV2":
|
||||
play_ambiance("Demeter")
|
||||
"demeter_midrun":
|
||||
play_ambiance("Demeter")
|
||||
"demeter_outro":
|
||||
play_ambiance("Demeter")
|
||||
"failure":
|
||||
play_ambiance("Demeter")
|
||||
|
||||
func _on_timeline_ended():
|
||||
if SceneManager.actual_scene:
|
||||
_on_change_scene(SceneManager.actual_scene)
|
||||
|
||||
func play_music(player_name : String = "", from_random_time := false, fade_time := DEFAULT_FADE_TIME):
|
||||
music_action = AudioLaunch.new(
|
||||
player_name,
|
||||
from_random_time,
|
||||
fade_time
|
||||
)
|
||||
|
||||
func stop_music():
|
||||
music_action = AudioStop.new()
|
||||
|
||||
func play_ambiance(player_name : String = "", from_random_time := false, fade_time := DEFAULT_FADE_TIME):
|
||||
ambiance_action = AudioLaunch.new(
|
||||
player_name,
|
||||
from_random_time,
|
||||
fade_time
|
||||
)
|
||||
|
||||
func stop_ambiance():
|
||||
ambiance_action = AudioStop.new()
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
func fetch_default_volumes():
|
||||
var all_players := get_all_players()
|
||||
@@ -62,6 +177,7 @@ func fetch_default_volumes():
|
||||
for player in all_players:
|
||||
default_volumes[player] = player.volume_db
|
||||
|
||||
<<<<<<< HEAD
|
||||
func setup_volume():
|
||||
for player in get_all_players():
|
||||
player.volume_db = get_volume_from_parent(player)
|
||||
@@ -77,6 +193,19 @@ func get_volume_from_parent(player : AudioStreamPlayer) -> float:
|
||||
settings_volume = settings.music_volume
|
||||
|
||||
return default_volumes[player] + lerp(MIN_VOLUME, MAX_VOLUME, settings_volume)
|
||||
=======
|
||||
func setup_players_bus():
|
||||
for player in get_all_players():
|
||||
if player.get_parent() == %Musics:
|
||||
player.bus = (AudioServer.get_bus_name(SettingsData.MUSIC_BUS_ID))
|
||||
elif player.get_parent() == %Sfx:
|
||||
player.bus = (AudioServer.get_bus_name(SettingsData.SFX_BUS_ID))
|
||||
elif player.get_parent() == %Ambiance:
|
||||
player.bus = (AudioServer.get_bus_name(SettingsData.AMBIANCE_BUS_ID))
|
||||
|
||||
func get_volume(player : AudioStreamPlayer) -> float:
|
||||
return default_volumes[player]
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
func get_all_players() -> Array[AudioStreamPlayer]:
|
||||
var players : Array[AudioStreamPlayer] = []
|
||||
@@ -94,15 +223,41 @@ func get_players_from_node(node : Node) -> Array[AudioStreamPlayer]:
|
||||
streams.append(c)
|
||||
return streams
|
||||
|
||||
<<<<<<< HEAD
|
||||
func set_volume(player : AudioStreamPlayer, to : float, fade_time = default_fade_time) -> Tween:
|
||||
var fade_tween : Tween = get_tree().create_tween()
|
||||
=======
|
||||
func set_volume(player : AudioStreamPlayer, to : float, fade_time := 0.0) -> Tween:
|
||||
var fade_tween : Tween = get_tree().create_tween()
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
fade_tween.tween_property(player, "volume_db", to, fade_time)
|
||||
|
||||
return fade_tween
|
||||
|
||||
func start_player(player: AudioStreamPlayer, from_random_time = false, fade_time = DEFAULT_FADE_TIME):
|
||||
if player and not player.playing:
|
||||
player.play(
|
||||
0.0 if not from_random_time
|
||||
else randf_range(0.0, player.stream.get_length())
|
||||
)
|
||||
if fade_time > 0.0:
|
||||
player.volume_db = MIN_VOLUME
|
||||
await set_volume(player, get_volume(player), fade_time).finished
|
||||
|
||||
func stop_player(player : AudioStreamPlayer, fade_time = DEFAULT_FADE_TIME):
|
||||
if player and player.playing:
|
||||
if fade_time > 0.0:
|
||||
await set_volume(player, MIN_VOLUME, fade_time).finished
|
||||
player.stop()
|
||||
player.volume_db = get_volume(player)
|
||||
|
||||
func reset_volume(player : AudioStreamPlayer):
|
||||
<<<<<<< HEAD
|
||||
player.volume_db = get_volume_from_parent(player)
|
||||
=======
|
||||
player.volume_db = get_volume(player)
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
func play_sfx(sfx_name : String):
|
||||
var player := %Sfx.find_child(sfx_name) as AudioStreamPlayer
|
||||
@@ -111,6 +266,7 @@ func play_sfx(sfx_name : String):
|
||||
else:
|
||||
printerr("Sfx %s not found" % sfx_name)
|
||||
|
||||
<<<<<<< HEAD
|
||||
func play_music(music_name : String = ""):
|
||||
var old_music = playing_music
|
||||
playing_music = null
|
||||
@@ -144,3 +300,25 @@ func play_ambiance(ambiance_name : String = ""):
|
||||
set_volume(player, get_volume_from_parent(player))
|
||||
else:
|
||||
printerr("Ambiance %s not found" % ambiance_name)
|
||||
=======
|
||||
class AudioAction:
|
||||
pass
|
||||
|
||||
class AudioLaunch extends AudioAction:
|
||||
var player_name : String
|
||||
var from_random_time : bool
|
||||
var fade_time : float
|
||||
|
||||
func _init(
|
||||
_player_name : String,
|
||||
_from_random_time := false,
|
||||
_fade_time := DEFAULT_FADE_TIME,
|
||||
):
|
||||
player_name = _player_name
|
||||
from_random_time = _from_random_time
|
||||
fade_time = _fade_time
|
||||
|
||||
|
||||
class AudioStop extends AudioAction:
|
||||
pass
|
||||
>>>>>>> 65645d976a98b5bfd030770764e72893cb8d9ccd
|
||||
|
||||
Reference in New Issue
Block a user