feat: Support WAV files as well (#469)

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

View File

@@ -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()

View File

@@ -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()