Skip to content

Commit

Permalink
#87 Add warning when loop metadata is missing for AudioStreamWAV (#104)
Browse files Browse the repository at this point in the history
* Add warning for AudioStreamWAV in audio_cue.gd

* Fix comments on the PR
  • Loading branch information
JuannFerrari authored Nov 10, 2023
1 parent 66e8f5d commit cfe7a32
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions addons/popochiu/engine/audio_manager/audio_cue.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit cfe7a32

Please sign in to comment.