Skip to content

Commit

Permalink
feat: Support WAV files as well (godot-escoria#469)
Browse files Browse the repository at this point in the history
Co-authored-by: Dennis Ploeger <[email protected]>
  • Loading branch information
dploeger and dploeger authored Nov 28, 2021
1 parent 0746976 commit 692314f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 5 additions & 1 deletion addons/escoria-core/game/scenes/sound/esc_music_player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
5 changes: 4 additions & 1 deletion addons/escoria-core/game/scenes/sound/esc_sound_player.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 692314f

Please sign in to comment.