I'd like to create a callback when a sound finishes playing, and it doesn't appear to work like anything else I've encountered using pysdl2 so far.
When I call Mix_ChannelFinished(my_func) where my_func is a standard Python function, I get this error:
ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected CFunctionType instance instead of method
My attempt to give it a CFunctionType instance looks like this:
MYFUNCTYPE = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.POINTER(ctypes.c_int)) my_c_func = MYFUNCTYPE(my_python_func) sdlmixer.Mix_ChannelFinished(my_c_func)
but this gives the error:
ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected CFunctionType instance instead of CFunctionType
I'm sure I'm doing something very simple wrong here, but it's non-obvious enough that it would be nice to have an example of how to do this properly in pysdl2's excellent docs!