I've had this problem before but can't rememeber how I coded around it, I've run into it again so have broken it down to the simplest code I can, the output of the code below is always:
recordSample()
recordSample()
The callback only works once, is this something I'm missing in Lua or a bug with the API?
buffer = nil
slot = 0
function recordSample()
print("recordSample()")
buffer = playdate.sound.sample.new(5, playdate.sound.kFormat16bitMono)
playdate.sound.micinput.recordToSample(buffer, function(sample)
slot += 1
sample:save("" .. slot)
recordSample()
end)
end
recordSample()
function playdate.update()
end