In 2.5.0, there seems to be a nasty bug in the audio system that causes the device and simulator to hard crash (i.e. simulator closes, device crashes with no stack trace).
It stems from loading a nonexistent file into the fileplayer, then attempting to play any other audio source (sampleplayer or fileplayer both work). I've setup a fun "Press A to crash" demo of it below in a mere 9 lines of lua code. This costed me a couple hours of debugging due to lack of stack trace. I assume the intended behaviour here is to catch an exception related to the failed load, or fail silently, but not crash the entire runtime
note: in this example, "beep.wav" exists and "idontexist.wav" does not exist
sample = playdate.sound.sampleplayer.new("beep")
fileplayer = playdate.sound.fileplayer.new()
fileplayer:load("idontexist")
fileplayer:play(0)
function playdate.update()
if(playdate.buttonJustPressed(playdate.kButtonA)) then
sample:play()
end
end
When I run this sample code in 2.5 I get an exception in the debugger or nothing outside of the debugger. On the device I see no crash. Are you sure there isn't more to this?
It's important that the sampleplayer audio does exist in the build. I've included a build here, which I've confirmed crashes on device (2.5.0, rev A) as well as on both Windows machines I've tried. Don't have access to a Mac simulator so not sure what happens there. I can upload the source project if needed, but it's literally just the above in main.lua and a random sfx beep.wav (the specific sound does not matter, I've tested several).