Looping sampleplayer randomly stops playing. Player stops and setLoopCallback() stops being called but isPlaying() still returns true and both getVolume() / getRate() return correct values.
Not sure if the trigger is too many setRate() calls, a specific rate value, specific audio file or something completely else. I created a minimal example (the sound is unpleasant, but it’s the original):
sp.zip (88.5 KB)
To reproduce: Run this on simulator (I use Mac/M1) or real playdate HW and wait a bit. It breaks randomly — sometimes in just a few seconds, sometimes after a bit (if it doesn’t break in about 30s I get antsy and restart the game in simulator, but when testing in-game, it sometimes stopped even after many minutes). Rate + volume and isPlaying are on display, loopCallback prints into console.
It behaves just like buffer underrun in fileplayer (the rest of the game continues to run just fine) but I’m not sure how that could apply to sampleplayer that has it all loaded in ram. Also, the minimal example above seems to indicate that it’s not a cpu/ram issue.
After trying out many things over last week, I found that reducing number of callbacks, rounding the rate to 1 decimal, or setting restricted playRange might have fixed the issue — but as I don’t know the cause, maybe it’s now just less frequent. (Now I even get that setting rate on every update is needless/bad practice ;-))
Also, thanks for a great SDK – for me it’s one of the most frictionless experiences with a new env!