예제 #1
0
파일: alc.py 프로젝트: gdos/pgreloaded
def get_error(device):
    """Gets the most recent error generated within the AL system for the
    specific device.
    """
    return dll.alcGetError(ctypes.byref(device))
예제 #2
0
파일: alc.py 프로젝트: gdos/pgreloaded
class ALCcontext(ctypes.Structure):
    """An execution context on a OpenAL device."""

    pass


_ERRMAP = {
    ALC_NO_ERROR: "No Error",
    ALC_INVALID_DEVICE: "Invalid device",
    ALC_INVALID_CONTEXT: "Invalid context",
    ALC_INVALID_ENUM: "Invalid enum",
    ALC_INVALID_VALUE: "Invalid value",
    ALC_OUT_OF_MEMORY: "Out of memory",
}
_FASTERROR = lambda dev: _ERRMAP[dll.alcGetError(ctypes.byref(dev))]


@openaltype("alcGetError", [ctypes.POINTER(ALCdevice)], ctypes.c_int)
def get_error(device):
    """Gets the most recent error generated within the AL system for the
    specific device.
    """
    return dll.alcGetError(ctypes.byref(device))


@openaltype("alcCreateContext", [ctypes.POINTER(ALCdevice), ctypes.POINTER(ctypes.c_int)], ctypes.POINTER(ALCcontext))
def create_context(device, attrs=None):
    """Creates a context from the specified device."""
    ptr = None
    if attrs is not None: