Crash when using sounds (probably)

Hello, my game crashes when it plays a sounds. Firstly, I thought that the reason is related with sound stack overflow or something, but after I managed to play only one sound at a time on each sound component, it still crashes…

Crashdump:
Assertion failed: instance->m_FrameCount == mix_buffer_count, file …\src\sound.cpp, line 1164
INFO:CRASH: Successfully wrote Crashdump to file: C:\Users\Lopl\AppData\Roaming\Defold/_crash
ERROR:CRASH: CALL STACK:

ERROR:CRASH: 0 0x7FF6A11E3AF0 dmCrash::GenerateCallstack D:\a\defold\defold\engine\crash\src\backtrace_win32.cpp:144
ERROR:CRASH: 1 0x7FF6A15C1A4C raise /tmp/job8005690811911277166/minkernel/crts/ucrt/src/appcrt/misc/signal.cpp:547
ERROR:CRASH: 2 0x7FF6A15B23A8 abort /tmp/job8005690811911277166/minkernel/crts/ucrt/src/appcrt/startup/abort.cpp:71
ERROR:CRASH: 3 0x7FF6A15B1354 common_assert_to_stderr<wchar_t> /tmp/job8005690811911277166/minkernel/crts/ucrt/src/appcrt/startup/assert.cpp:186
ERROR:CRASH: 4 0x7FF6A15B0E6C _wassert /tmp/job8005690811911277166/minkernel/crts/ucrt/src/appcrt/startup/assert.cpp:443
ERROR:CRASH: 5 0x7FF6A11D60F0 dmSound::MixResampleIdentityStereo<short,0,1> D:\a\defold\defold\engine\sound\src\sound.cpp:1166
ERROR:CRASH: 6 0x7FF6A11D6440 dmSound::Mix D:\a\defold\defold\engine\sound\src\sound.cpp:1261
ERROR:CRASH: 7 0x7FF6A11D6780 dmSound::MixInstance D:\a\defold\defold\engine\sound\src\sound.cpp:1395
ERROR:CRASH: 8 0x7FF6A11D6B90 dmSound::MixInstances D:\a\defold\defold\engine\sound\src\sound.cpp:1451
ERROR:CRASH: 9 0x7FF6A11D3710 dmSound::SoundThread D:\a\defold\defold\engine\sound\src\sound.cpp:1652
ERROR:CRASH: 10 0x7FF9E1F02580 BaseThreadInitThunk :0
ERROR:CRASH: 11 0x7FF9E364AF10 RtlUserThreadStart :0
ERROR:CRASH:

I play sound this way:

local function setWorldSpeed(speed)
	currentWorldSpeed = speed
	go.set("#sound", "speed", speed)
	if not isSoundPlaying then
		isSoundPlaying = true
		sound.play("#sound", {}, function() isSoundPlaying = false print("SOUND DONE") end)
		msg.post(SCENE_MANAGER, "SetWorldSpeed", {worldSpeed = speed})
		msg.post(HUD, "SetWorldSpeed", {worldSpeed = speed})
	end
end

And if it matters, I also change time_step after starting to play a sound

if message_id == hash("SetWorldSpeed") then
	   go.set("#brushSound", "speed", message.worldSpeed)
	   msg.post(currentWorld, "set_time_step", {factor = message.worldSpeed, mode = 0})
    end

It turned out that my ogg files was not validated, so then I used wav, but with no result, when thay were converted in audacity. I used an online converted and it seems, it solved the problem.

2 Likes

Soon, in defold 1.9.9 (I hope), we can support any sample rate from the .ogg files, and you can start using them again.

2 Likes