[C-API] How to pass in userdata to the sndCallbackProc callbacks?


I am using the setLoopCallback function for SamplePlayer, but I don't see a way to pass in userdata like I can with other callbacks. Is there a way to do this that I am not seeing, or do I have to resort to global variables? If there is no way to do this, what is the reason we can pass in userdata in other callbacks, but not here?

Thank you!

This appears to be an oversight. My guess is that the optional userdata arguments in the Lua versions of playdate.sound.sampleplayer:setLoopCallback() and setFinishCallback() were added after the initial spec, and that the C versions were never revisited for parity.

I opened up this feature request in hopes of getting this resolved.

1 Like

Thank you very much!