fix(sfx): duplicate OGG stream before setting loop to avoid shared resource mutation

This commit is contained in:
Steven Wroblewski
2026-05-10 21:53:51 +02:00
parent 80274b0294
commit b7757a5548
+8 -4
View File
@@ -33,11 +33,15 @@ func _setup_audio() -> void:
return return
if not ResourceLoader.exists(_HEARTBEAT_PATH): if not ResourceLoader.exists(_HEARTBEAT_PATH):
return return
var stream: AudioStreamOggVorbis = load(_HEARTBEAT_PATH) as AudioStreamOggVorbis var base: AudioStream = load(_HEARTBEAT_PATH) as AudioStream
if stream == null: if base == null:
return return
stream.loop = true var ogg: AudioStreamOggVorbis = base as AudioStreamOggVorbis
_audio.stream = stream if ogg == null:
return
ogg = ogg.duplicate() as AudioStreamOggVorbis
ogg.loop = true
_audio.stream = ogg
func _on_room_changed(floor_index: int, room_index: int) -> void: func _on_room_changed(floor_index: int, room_index: int) -> void: