feat: Support WAV files as well (#469)

Co-authored-by: Dennis Ploeger <develop@dieploegers.de>
This commit is contained in:
Dennis PloegerandDennis Ploeger authored and GitHub committed 2021-11-28 15:36:50 +01:00
1 parent 55e2ed5e59
commit 0e295f0ebb
7 files changed
+38 -3

No files matched your search

@@ -39,7 +39,11 @@ func set_state(p_state: String, p_force: bool = false) -> void:
stream.stream = resource
if stream.stream:
resource.set_loop(true)
if resource is AudioStreamSample:
resource.loop_mode = AudioStreamSample.LOOP_FORWARD
resource.loop_end = resource.mix_rate * resource.get_length()
elif "loop" in resource:
resource.loop = true
if ProjectSettings.has_setting("escoria/sound/music_volume"):
stream.volume_db = ProjectSettings.get_setting("escoria/sound/music_volume")
stream.play()
@@ -39,7 +39,10 @@ func set_state(p_state: String, p_force: bool = false):
stream.stream = resource
if stream.stream:
resource.set_loop(false)
if resource is AudioStreamSample:
resource.loop_mode = AudioStreamSample.LOOP_DISABLED
elif "loop" in resource:
resource.loop = false
if ProjectSettings.has_setting("escoria/sound/sound_volume"):
stream.volume_db = ProjectSettings.get_setting("escoria/sound/sound_volume")
stream.play()