cocos.audio.SDL.dll module

class SDL_DLL(library_name, version_function_name, version=None)

Bases: object

assert_version_compatible(name, since)

Raises an exception if since is later than the loaded library.

function(name, doc, args=[], arg_types=[], return_type=None, dereference_return=False, require_return=False, success_return=None, error_return=None, since=None)

Construct a wrapper function for ctypes.

Parameters:
name

The name of the function as it appears in the shared library.

doc

Docstring to associate with the wrapper function.

args

List of strings giving the argument names.

arg_types

List of ctypes classes giving the argument types.

return_type

The ctypes class giving the wrapped function’s native return type.

dereference_return

If True, the return value is assumed to be a pointer and will be dereferenced via .contents before being returned to the user application.

require_return

Used in conjunction with dereference_return; if True, an exception will be raised if the result is NULL; if False None will be returned when the result is NULL.

success_return

If not None, the expected result of the wrapped function. If the return value does not equal success_return, an exception will be raised.

error_return

If not None, the error result of the wrapped function. If the return value equals error_return, an exception will be raised. Cannot be used in conjunction with success_return.

since

Tuple (major, minor, patch) or string ‘x.y.z’ of the first version of SDL in which this function appears. If the loaded version predates it, a placeholder function that raises SDL_NotImplementedError will be returned instead. Set to None if the function is in all versions of SDL.

private_function(name, **kwargs)

Construct a wrapper function for ctypes with internal documentation and no argument names.

version_compatible(v)

Returns True iff v is equal to or later than the loaded library version.