Sound crashes when I try to change file with load_resource

Sound object crashes sometimes when I try to load another .wav with load_resource. Seems like it depends on wav size.

    wav = sys.load_resource("/_resources/sound/" .. type .. ".wav")
	soundSlot = go.get("sound#psound", "sound")
	resource.set_sound(soundSlot, wav)"sound#psound", {delay = 0, gain = settings.sound, pan = 0, speed = 1, loop = looping})
ERROR:CRASH:  0 0x7FF7AAD852C0 memcpy_repmovs d:\agent\_work\4\s\src\vctools\crt\vcruntime\src\string\amd64\memcpy.asm:114
ERROR:CRASH:  1 0x7FF7AAA30EB0 dmSoundCodec::WavDecodeStream D:\a\defold\defold\engine\sound\src\decoders\decoder_wav.cpp:222
ERROR:CRASH:  2 0x7FF7AAAC05A0 dmSoundCodec::Decode D:\a\defold\defold\engine\sound\src\sound_codec.cpp:101
ERROR:CRASH:  3 0x7FF7AAA48950 dmSound::MixInstance D:\a\defold\defold\engine\sound\src\sound.cpp:1161
ERROR:CRASH:  4 0x7FF7AAA48DC0 dmSound::MixInstances D:\a\defold\defold\engine\sound\src\sound.cpp:1272
ERROR:CRASH:  5 0x7FF7AAA454B0 dmSound::SoundThread D:\a\defold\defold\engine\sound\src\sound.cpp:1466
ERROR:CRASH:  6 0x7FFF35857020 BaseThreadInitThunk <unknown>:0
ERROR:CRASH:  7 0x7FFF359C2630 RtlUserThreadStart <unknown>:0
INFO:CRASH: Successfully wrote MiniDump to file: C:\Users\....\AppData\Roaming\Defold/_crash.dmp (19.1 KB)

Are you perhaps playing the sound on sound#psound when you replace it? In either case, it is a bug that we need to look into. Would you mind creating a ticket on GH with a small repro case (or at least attach the two sounds you use)?


Glad I could help! I’ll try to make a repro or ticket asap.
Sry, it’s only a week left till Next Fest.


Well, not sure what exactly happened, but I’ve made another sound container (lsound) with loop on. And removed that “loop = looping” parameter from“sound#psound”…

No crushes for a week. At least not with sound.