This happens on macOS 12.3.1, with SDK 1.9.3. It appears all you need to do is call both print
and playdate.sound.micinput.stopRecording()
.
See it in action here:
Repro steps:
- Open the enclosed project (or copy the pasted code below)
- Run it in the simulator
- Wait a moment
- Try to resize the console window.
The code I used to crash it is this:
local snd <const> = playdate.sound
local updateCall = 0
local recording = snd.sample.new(5.0, snd.kFormat16bitMono)
local player = snd.sampleplayer.new(recording)
function playdate.update()
-- updateCall is used to make sure these methods are called in a specific
-- order, to get the app in a specific state.
updateCall += 1
if updateCall == 1 then
-- `print` has to be called. Commenting this out avoids the crash
print("Launched")
elseif updateCall == 5 then
-- Strictly speaking, this call isn't needed. It will crash whether or
-- not this method is called.
snd.micinput.recordToSample(recording, function () end)
elseif updateCall == 100 then
-- `stopRecording` has to be called. Commenting this out avoids the crash.
snd.micinput.stopRecording()
end
end