From cfe7a32605999126f51843420e2a5d587f7518c1 Mon Sep 17 00:00:00 2001 From: Juan Ferrari Date: Fri, 10 Nov 2023 11:10:59 -0300 Subject: [PATCH] #87 Add warning when loop metadata is missing for AudioStreamWAV (#104) * Add warning for AudioStreamWAV in audio_cue.gd * Fix comments on the PR --- addons/popochiu/engine/audio_manager/audio_cue.gd | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/addons/popochiu/engine/audio_manager/audio_cue.gd b/addons/popochiu/engine/audio_manager/audio_cue.gd index 3c9e78b1..a6620b0e 100644 --- a/addons/popochiu/engine/audio_manager/audio_cue.gd +++ b/addons/popochiu/engine/audio_manager/audio_cue.gd @@ -93,9 +93,16 @@ func set_loop(value: bool) -> void: 'AudioStreamOggVorbis', 'AudioStreamMP3': audio.loop = value 'AudioStreamWAV': - (audio as AudioStreamWAV).loop_mode =\ - AudioStreamWAV.LOOP_FORWARD if value\ - else AudioStreamWAV.LOOP_DISABLED + if (audio as AudioStreamWAV).get_loop_end() == 0 && value: + PopochiuUtils.print_warning( + "[b]%s[/b]" % resource_name +\ + " does not have the correct metadata to loop, please check" +\ + " AudioStreamWAV documentation" + ) + else: + (audio as AudioStreamWAV).loop_mode =\ + AudioStreamWAV.LOOP_FORWARD if value\ + else AudioStreamWAV.LOOP_DISABLED notify_property_list_changed()