コード例 #1
0
 class IMMDevice(_IUnknown):
     _iid_ = GUID('{D666063F-1587-4E43-81F1-B948E807363F}')
     _methods_ = [
         _COMMETHOD(
             [], _HRESULT, 'Activate', (['in'], _POINTER(GUID), 'iid'),
             (['in'], _DWORD, 'dwClsCtx'),
             (['in'], _POINTER(_DWORD), 'pActivationParans'),
             (['out', 'retval'], _POINTER(
                 _POINTER(IAudioEndpointVolume)), 'ppInterface')),
         _STDMETHOD(_HRESULT, 'OpenPropertyStore', []),
         _STDMETHOD(_HRESULT, 'GetId', []),
         _STDMETHOD(_HRESULT, 'GetState', [])
     ]
     pass
コード例 #2
0
    class IMMDeviceEnumerator(_IUnknown):
        _iid_ = GUID('{A95664D2-9614-4F35-A746-DE8DB63617E6}')

        _methods_ = [
            _COMMETHOD([], _HRESULT, 'EnumAudioEndpoints',
                       (['in'], _DWORD, 'dataFlow'),
                       (['in'], _DWORD, 'dwStateMask'),
                       (['out', 'retval'],
                        _POINTER(_POINTER(IMMDeviceCollection)), 'ppDevices')),
            _COMMETHOD([], _HRESULT, 'GetDefaultAudioEndpoint',
                       (['in'], _DWORD, 'dataFlow'), (['in'], _DWORD, 'role'),
                       (['out', 'retval'], _POINTER(
                           _POINTER(IMMDevice)), 'ppDevices'))
        ]
コード例 #3
0
class IMMDeviceEnumerator(comtypes.IUnknown):
    _iid_ = IID_IMMDeviceEnumerator
    _methods_ = (
        _COMMETHOD([], _HRESULT,
            'EnumAudioEndpoints',
            (['in'], _DWORD, 'dataFlow'),
            (['in'], _DWORD, 'dwStateMask'),
            (['out','retval'],
             _POINTER(_POINTER(IMMDeviceCollection)), 'ppDevices')),
        _COMMETHOD([], _HRESULT,
            'GetDefaultAudioEndpoint',
            (['in'], _DWORD, 'dataFlow'),
            (['in'], _DWORD, 'role'),
            (['out','retval'],
             _POINTER(_POINTER(IMMDevice)), 'ppDevices')))
コード例 #4
0
    def _init_fpga(self):
        """
        Initialize FPGA handle with driver library.
        """
        # Set FPGA handle to default value
        self._fpga_handle = _c_int(-1)  # PCI_BAR_HANDLE_INIT

        # Attach FPGA
        fpga_pci_attach = self._fpga_library.fpga_pci_attach
        fpga_pci_attach.restype = _c_int  # return code
        fpga_pci_attach.argtypes = (
            _c_int,  # slot_id
            _c_int,  # pf_id
            _c_int,  # bar_id
            _c_uint32,  # flags
            _POINTER(_c_int)  # handle
        )

        if fpga_pci_attach(
                self._fpga_slot_id,
                0,  # FPGA_APP_PF
                0,  # APP_PF_BAR0
                0,
                _byref(self._fpga_handle)):
            raise RuntimeError("Unable to attach to the AFI on slot ID %s" %
                               self._fpga_slot_id)
コード例 #5
0
    def _get_read_register_callback(self):
        """
        Read register callback.

        Returns:
            function: Read register callback
        """
        fpga_pci_peek = self._fpga_library.fpga_pci_peek
        fpga_pci_peek.restype = _c_int  # return code
        fpga_pci_peek.argtypes = (
            _c_int,  # handle
            _c_uint64,  # offset
            _POINTER(_c_uint32)  # value
        )
        self._fpga_read_register = fpga_pci_peek

        def read_register(register_offset, returned_data, driver=self):
            """
            Read register.

            Args:
                register_offset (int): Offset
                returned_data (int pointer): Return data.
                driver (python_fpga_drivers.aws_f1.FpgaDriver):
                    Keep a reference to driver.
            """
            with driver._fpga_read_register_lock:
                return driver._fpga_read_register(
                    driver._fpga_handle,
                    driver._drm_ctrl_base_addr + register_offset,
                    returned_data)

        return read_register
コード例 #6
0
ファイル: _aws_xrt.py プロジェクト: Accelize/drm
    def _init_fpga(self):
        """
        Initialize FPGA handle with driver library.
        """
        # Find all devices
        xcl_probe = self._fpga_library.xclProbe
        xcl_probe.restype = _c_uint  # Devices count

        if xcl_probe() < 1:
            raise RuntimeError("xclProbe does not found devices")

        # Open device
        xcl_open = self._fpga_library.xclOpen
        xcl_open.restype = _POINTER(_c_void_p)  # Device handle
        xcl_open.argtypes = (
            _c_uint,  # deviceIndex
            _c_char_p,  # logFileName
            _c_int,  # level
        )
        log_file = _join(self._log_dir, 'slot_%d_xrt.log' % self._fpga_slot_id)
        device_handle = xcl_open(
            self._fpga_slot_id,
            log_file.encode(),
            3  # XCL_ERROR
        )
        if not device_handle:
            raise RuntimeError("xclOpen failed to open device")
        self._fpga_handle = device_handle
コード例 #7
0
    def _init_fpga(self):
        """
        Initialize FPGA handle with XRT and OpenCL libraries.
        """
        dev = cl.get_platforms()[0].get_devices()
        binary = open(self._fpga_image, 'rb').read()
        ctx = cl.Context(dev_type=cl.device_type.ALL)
        prg = cl.Program(ctx, dev, [binary])
        prg.build()

        # Find all devices
        xcl_probe = self._fpga_library.xclProbe
        xcl_probe.restype = _c_uint  # Devices count

        if xcl_probe() < 1:
            raise RuntimeError("xclProbe does not found devices")

        # Open device
        xcl_open = self._fpga_library.xclOpen
        xcl_open.restype = _POINTER(_c_void_p)  # Device handle
        xcl_open.argtypes = (
            _c_uint,  # deviceIndex
            _c_char_p,  # logFileName
            _c_int,  # level
        )
        log_file = _join(self._log_dir, 'slot_%d_xrt.log' % self._fpga_slot_id)
        device_handle = xcl_open(
            self._fpga_slot_id,
            log_file.encode(),
            3  # XCL_ERROR
        )
        if not device_handle:
            raise RuntimeError("xclOpen failed to open device")
        self._fpga_handle = device_handle
コード例 #8
0
class IMMDevice(comtypes.IUnknown):
    _iid_ = IID_IMMDevice
    _methods_ = (
        _COMMETHOD([], _HRESULT,
            'Activate',
            (['in'], _POINTER(_GUID), 'iid'),
            (['in'], _DWORD, 'dwClsCtx'),
            (['in'], _POINTER(_DWORD), 'pActivationParams'),
            (['out','retval'],
             _POINTER(_POINTER(IAudioEndpointVolume)), 'ppInterface')),
        _STDMETHOD(_HRESULT,
            'OpenPropertyStore', []),
        _STDMETHOD(_HRESULT,
            'GetId', []),
        _STDMETHOD(_HRESULT,
            'GetState', []))
コード例 #9
0
	def __init__(self, endpoint, endpoints, PKEY_Device=PKEY_Device_FriendlyName):
		"""Initializes an endpoint object."""
		self.endpoint = endpoint
		self.endpoints = endpoints
		self.PKEY_Device = PKEY_Device
		self.IAudioEndpointVolume = _POINTER(IAudioEndpointVolume)(endpoint.Activate(IID_IAudioEndpointVolume, CLSCTX_INPROC_SERVER, None))
		self._AudioVolume = AudioVolume(endpoint, self.IAudioEndpointVolume)
コード例 #10
0
ファイル: delete.py プロジェクト: DamirAinullin/PTVS
    def POINTER(obj):
        ptr = _POINTER(obj)
        # Convert None to a real NULL pointer to work around bugs
        # in how ctypes handles None on 64-bit platforms
        if not isinstance(ptr.from_param, classmethod):
            def from_param(cls, x):
                if x is None:
                    return cls()
                return x

            ptr.from_param = classmethod(from_param)
        return ptr
コード例 #11
0
    def POINTER(obj):
        ptr = _POINTER(obj)
        # Convert None to a real NULL pointer to work around bugs
        # in how ctypes handles None on 64-bit platforms
        if not isinstance(ptr.from_param, classmethod):
            def from_param(cls, x):
                if x is None:
                    return cls()
                return x

            ptr.from_param = classmethod(from_param)
        return ptr
コード例 #12
0
 def __init__(self,
              endpoint,
              endpoints,
              PKEY_Device=PKEY_Device_FriendlyName):
     """Initializes an endpoint object."""
     self.endpoint = endpoint
     self.endpoints = endpoints
     self.PKEY_Device = PKEY_Device
     self.IAudioEndpointVolume = _POINTER(IAudioEndpointVolume)(
         endpoint.Activate(IID_IAudioEndpointVolume, CLSCTX_INPROC_SERVER,
                           None))
     self._AudioVolume = AudioVolume(endpoint, self.IAudioEndpointVolume)
コード例 #13
0
def scan_contexts():
	d = dict()
	ptr = _POINTER(_ContextInfoPtr)()

	ctx = _create_scan_context(None, 0)
	nb = _get_context_info_list(ctx, _byref(ptr));

	for i in range(0, nb):
		d[_context_info_get_uri(ptr[i])] = _context_info_get_description(ptr[i])

	_context_info_list_free(ptr)
	_destroy_scan_context(ctx)
	return d
コード例 #14
0
ファイル: iio.py プロジェクト: analogdevicesinc/libiio
def scan_contexts():
	d = dict()
	ptr = _POINTER(_ContextInfoPtr)()

	ctx = _create_scan_context(None, 0)
	nb = _get_context_info_list(ctx, _byref(ptr));

	for i in range(0, nb):
		d[_context_info_get_uri(ptr[i]).decode('ascii')] = _context_info_get_description(ptr[i]).decode('ascii')

	_context_info_list_free(ptr)
	_destroy_scan_context(ctx)
	return d
コード例 #15
0
def scan_contexts():
    """Scan Context."""
    scan_ctx = dict()
    ptr = _POINTER(_ContextInfoPtr)()

    ctx = _create_scan_context(None, 0)
    ctx_nb = _get_context_info_list(ctx, _byref(ptr))

    for i in range(0, ctx_nb):
        scan_ctx[_context_info_get_uri(
            ptr[i]).decode("ascii")] = _context_info_get_description(
                ptr[i]).decode("ascii")

    _context_info_list_free(ptr)
    _destroy_scan_context(ctx)
    return scan_ctx
コード例 #16
0
class IAudioEndpointVolume(comtypes.IUnknown):
    _iid_ = IID_IAudioEndpointVolume
    _methods_ = (
        _STDMETHOD(_HRESULT,
            'RegisterControlChangeNotify', []),
        _STDMETHOD(_HRESULT,
            'UnregisterControlChangeNotify', []),
        _STDMETHOD(_HRESULT,
            'GetChannelCount', []),
        _COMMETHOD([], _HRESULT,
            'SetMasterVolumeLevel',
            (['in'], _c_float, 'fLevelDB'),
            (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT,
            'SetMasterVolumeLevelScalar',
            (['in'], _c_float, 'fLevelDB'),
            (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT,
            'GetMasterVolumeLevel',
            (['out','retval'], _POINTER(ctypes.c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT,
            'GetMasterVolumeLevelScalar',
            (['out','retval'], _POINTER(_c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT,
            'SetChannelVolumeLevel',
            (['in'], _DWORD, 'nChannel'),
            (['in'], _c_float, 'fLevelDB'),
            (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT,
            'SetChannelVolumeLevelScalar',
            (['in'], _DWORD, 'nChannel'),
            (['in'], _c_float, 'fLevelDB'),
            (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT,
            'GetChannelVolumeLevel',
            (['in'], _DWORD, 'nChannel'),
            (['out','retval'], _POINTER(_c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT,
            'GetChannelVolumeLevelScalar',
            (['in'], _DWORD, 'nChannel'),
            (['out','retval'], _POINTER(_c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT,
            'SetMute',
            (['in'], _BOOL, 'bMute'),
            (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT,
            'GetMute',
            (['out','retval'], _POINTER(_BOOL), 'pbMute')),
        _COMMETHOD([], _HRESULT,
            'GetVolumeStepInfo',
            (['out','retval'], _POINTER(_c_float), 'pnStep'),
            (['out','retval'], _POINTER(_c_float), 'pnStepCount')),
        _COMMETHOD([], _HRESULT,
            'VolumeStepUp',
            (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT,
            'VolumeStepDown',
            (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT,
            'QueryHardwareSupport',
            (['out','retval'], _POINTER(_DWORD), 'pdwHardwareSupportMask')),
        _COMMETHOD([], _HRESULT,
            'GetVolumeRange',
            (['out','retval'], _POINTER(_c_float), 'pfMin'),
            (['out','retval'], _POINTER(_c_float), 'pfMax'),
            (['out','retval'], _POINTER(_c_float), 'pfIncr')))
コード例 #17
0
ファイル: _win32api.py プロジェクト: blubberdiblub/ezconsole
def _errcheck_return_success(result, func, _) -> None:

    if not result:
        raise Win32APIError(f"{func.__name__}() failed")


_windll = _LibraryLoader(_WinDLL)


CloseHandle = _windll.kernel32.CloseHandle
CloseHandle.argtypes = [HANDLE]
CloseHandle.restype = BOOL
CloseHandle.errcheck = _errcheck_return_success

CreateFileW = _windll.kernel32.CreateFileW
CreateFileW.argtypes = [LPCWSTR, DWORD, DWORD, _POINTER(SecurityAttributes),
                        DWORD, DWORD, HANDLE]
CreateFileW.restype = HANDLE
CreateFileW.errcheck = _errcheck_return_handle

GetStdHandle = _windll.kernel32.GetStdHandle
GetStdHandle.argtypes = [DWORD]
GetStdHandle.restype = HANDLE
GetStdHandle.errcheck = _errcheck_return_handle

CompareObjectHandles = _windll.kernelbase.CompareObjectHandles
CompareObjectHandles.argtypes = [HANDLE, HANDLE]
CompareObjectHandles.restype = BOOL

FillConsoleOutputCharacterW = _windll.kernel32.FillConsoleOutputCharacterW
FillConsoleOutputCharacterW.argtypes = [HANDLE, WCHAR, DWORD, Coord, LPDWORD]
コード例 #18
0
    IIO_CONCENTRATION = 24
    IIO_RESISTANCE = 25
    IIO_PH = 26
    IIO_UVINDEX = 27
    IIO_ELECTRICALCONDUCTIVITY = 28
    IIO_COUNT = 29
    IIO_INDEX = 30
    IIO_GRAVITY = 31
    IIO_POSITIONRELATIVE = 32
    IIO_PHASE = 33
    IIO_MASSCONCENTRATION = 34
    IIO_CHAN_TYPE_UNKNOWN = 0x7FFFFFFF


# pylint: disable=invalid-name
_ScanContextPtr = _POINTER(_ScanContext)
_ContextInfoPtr = _POINTER(_ContextInfo)
_ContextPtr = _POINTER(_Context)
_DevicePtr = _POINTER(_Device)
_ChannelPtr = _POINTER(_Channel)
_BufferPtr = _POINTER(_Buffer)
_DataFormatPtr = _POINTER(DataFormat)

if "Windows" in _system():
    _iiolib = "libiio.dll"
else:
    # Non-windows, possibly Posix system
    _iiolib = "iio"

_lib = _cdll(find_library(_iiolib), use_errno=True, use_last_error=True)
コード例 #19
0
ファイル: iio.py プロジェクト: analogdevicesinc/libiio
		raise OSError(-result, _strerror(-result))

class _ScanContext(Structure):
	pass
class _ContextInfo(Structure):
	pass
class _Context(Structure):
	pass
class _Device(Structure):
	pass
class _Channel(Structure):
	pass
class _Buffer(Structure):
	pass

_ScanContextPtr = _POINTER(_ScanContext)
_ContextInfoPtr = _POINTER(_ContextInfo)
_ContextPtr = _POINTER(_Context)
_DevicePtr = _POINTER(_Device)
_ChannelPtr = _POINTER(_Channel)
_BufferPtr = _POINTER(_Buffer)

_lib = _cdll('libiio.dll' if 'Windows' in _system() else 'libiio.so.0',
		use_errno = True, use_last_error = True)

_get_backends_count = _lib.iio_get_backends_count
_get_backends_count.restype = c_uint

_get_backend = _lib.iio_get_backend
_get_backend.argtypes = (c_uint, )
_get_backend.restype = c_char_p
コード例 #20
0
ファイル: iio.py プロジェクト: lrntplc/libiio
def _checkNegative(result, func, arguments):
	if result >= 0:
		return result
	else:
		raise Exception("Error: " + _strerror(-result))

class _Context(Structure):
	pass
class _Device(Structure):
	pass
class _Channel(Structure):
	pass
class _Buffer(Structure):
	pass

_ContextPtr = _POINTER(_Context)
_DevicePtr = _POINTER(_Device)
_ChannelPtr = _POINTER(_Channel)
_BufferPtr = _POINTER(_Buffer)

_lib = _cdll.LoadLibrary('libiio.dll' if 'Windows' in _system() else 'libiio.so.0')

_new_local = _lib.iio_create_local_context
_new_local.restype = _ContextPtr
_new_local.errcheck = _checkNull

_new_xml = _lib.iio_create_xml_context
_new_xml.restype = _ContextPtr
_new_xml.argtypes = (c_char_p, )
_new_xml.errcheck = _checkNull
コード例 #21
0
ファイル: iio.py プロジェクト: zengjunfeng/libiio
    pass


class _Device(Structure):
    pass


class _Channel(Structure):
    pass


class _Buffer(Structure):
    pass


_ContextPtr = _POINTER(_Context)
_DevicePtr = _POINTER(_Device)
_ChannelPtr = _POINTER(_Channel)
_BufferPtr = _POINTER(_Buffer)

_lib = _cdll.LoadLibrary('libiio.so.0')

_new_local = _lib.iio_create_local_context
_new_local.restype = _ContextPtr
_new_local.errcheck = _checkNull

_new_xml = _lib.iio_create_xml_context
_new_xml.restype = _ContextPtr
_new_xml.argtypes = (c_char_p, )
_new_xml.errcheck = _checkNull
コード例 #22
0
    UINT nChannels;
    float afChannelVolumes[ 1 ];
    }   AUDIO_VOLUME_NOTIFICATION_DATA;

typedef struct AUDIO_VOLUME_NOTIFICATION_DATA *PAUDIO_VOLUME_NOTIFICATION_DATA;
"""
class AUDIO_VOLUME_NOTIFICATION_DATA(Structure):
    pass
AUDIO_VOLUME_NOTIFICATION_DATA._fields_ = [
    ('guidEventContext', _GUID),
    ('bMuted', _BOOL),
    ('fMasterVolume', _c_float),
    ('nChannels', _UINT),
    ('afChannelVolumes', (_c_float * 1)),
]
PAUDIO_VOLUME_NOTIFICATION_DATA = _POINTER(AUDIO_VOLUME_NOTIFICATION_DATA)

IID_IAudioEndpointVolumeCallback = _GUID('{657804FA-D6AD-4496-8A60-352752AF4F89}')

class IAudioEndpointVolumeCallback(_IUnknown):
		_iid_ = IID_IAudioEndpointVolumeCallback
		_methods_ = [
				_COMMETHOD([], _HRESULT, 'OnNotify',
						(['in'], PAUDIO_VOLUME_NOTIFICATION_DATA, 'pNotify')
				),
		]

IID_IAudioEndpointVolume = _GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}')

class IAudioEndpointVolume(_IUnknown):
		_iid_ = _GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}')
コード例 #23
0
		raise OSError(-result, _strerror(-result))

class _ScanContext(Structure):
	pass
class _ContextInfo(Structure):
	pass
class _Context(Structure):
	pass
class _Device(Structure):
	pass
class _Channel(Structure):
	pass
class _Buffer(Structure):
	pass

_ScanContextPtr = _POINTER(_ScanContext)
_ContextInfoPtr = _POINTER(_ContextInfo)
_ContextPtr = _POINTER(_Context)
_DevicePtr = _POINTER(_Device)
_ChannelPtr = _POINTER(_Channel)
_BufferPtr = _POINTER(_Buffer)

_lib = _cdll('libiio.dll' if 'Windows' in _system() else 'libiio.so.0',
		use_errno = True, use_last_error = True)

_create_scan_context = _lib.iio_create_scan_context
_create_scan_context.argtypes = (c_char_p, c_uint)
_create_scan_context.restype = _ScanContextPtr
_create_scan_context.errcheck = _checkNull

_destroy_scan_context = _lib.iio_scan_context_destroy
コード例 #24
0
			if not isinstance(a, str): continue
			args[idx] = a.encode('utf8')

		for k, a in kwargs.items():
			if not isinstance(a, str): continue
			kwargs[k] = a.encode('utf8')

		res = func(*args, **kwargs)

		if isinstance(res, bytes):
			res = res.decode('utf8')

		return res

	return wrapper
_ContextPtr = _POINTER(_Context)
_DevicePtr = _POINTER(_Device)
_ChannelPtr = _POINTER(_Channel)
_BufferPtr = _POINTER(_Buffer)

_lib = _cdll.LoadLibrary('libiio.dll' if 'Windows' in _system() else 'libiio.so')

_new_local = _lib.iio_create_local_context
_new_local.restype = _ContextPtr
_new_local.errcheck = _checkNull
_new_local = _unicode_decorator(_new_local)

_new_xml = _lib.iio_create_xml_context
_new_xml.restype = _ContextPtr
_new_xml.argtypes = (c_char_p, )
_new_xml.errcheck = _checkNull
コード例 #25
0
"""Interface to C flux models library.
"""

import os
from ctypes import byref as _byref, cdll as _cdll, c_double, c_int, c_void_p, POINTER as _POINTER

_path = os.path.dirname(__file__)
_path = os.path.abspath(os.path.join(_path, '..', 'lib', 'libflux.so.1.0.1'))

_libflux = _cdll.LoadLibrary(_path)

_libflux.differential_flux.argtypes = [c_int, c_double, c_double, c_double, c_double, _POINTER(c_double)]
_libflux.differential_flux.restype = c_double

def differential_flux(model, momentum, theta, phi=0., altitude=0., latitude=None):
    """Generic interface to a flux model.
    """
    
    if not (latitude is None):
        latitude = _byref(c_double(latitude))
	
    return _libflux.differential_flux(model, c_double(momentum), c_double(theta), c_double(phi), c_double(altitude), latitude)

"""
Available flux models.
"""
models = {
    'CHIRKIN'          : 0,
    'MODIFIED_CHIRKIN' : 1 
}
for _model, _index in models.iteritems():
コード例 #26
0
# WaitNative engines
EGL_CORE_NATIVE_ENGINE = 0x305B

# EGL 1.2 tokens renamed for consistency in EGL 1.3
EGL_COLORSPACE = EGL_VG_COLORSPACE
EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT
EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB
EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR
EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE
EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE

## The functions

_lib.eglGetDisplay.argtypes = _c_int,
_lib.eglGetDisplay.restype = c_void_p
_lib.eglInitialize.argtypes = c_void_p, _POINTER(_c_int), _POINTER(_c_int)
_lib.eglTerminate.argtypes = c_void_p,
_lib.eglChooseConfig.argtypes = (c_void_p, _POINTER(_c_int),
                                 _POINTER(c_void_p), _c_int, _POINTER(_c_int))
_lib.eglCreateWindowSurface.argtypes = (c_void_p, c_void_p, c_void_p,
                                        _POINTER(_c_int))
_lib.eglCreateWindowSurface.restype = c_void_p
_lib.eglCreatePbufferSurface.argtypes = (c_void_p, c_void_p, _POINTER(_c_int))
_lib.eglCreatePbufferSurface.restype = c_void_p
_lib.eglCreateContext.argtypes = c_void_p, c_void_p, c_void_p, _POINTER(_c_int)
_lib.eglCreateContext.restype = c_void_p
_lib.eglMakeCurrent.argtypes = (c_void_p, ) * 4
_lib.eglBindAPI.argtypes = _c_int,
_lib.eglSwapBuffers.argtypes = (c_void_p, ) * 2
_lib.eglDestroySurface.argtypes = (c_void_p, ) * 2
_lib.eglQueryString.argtypes = (c_void_p, _c_int)
コード例 #27
0
typedef struct AUDIO_VOLUME_NOTIFICATION_DATA *PAUDIO_VOLUME_NOTIFICATION_DATA;
"""


class AUDIO_VOLUME_NOTIFICATION_DATA(Structure):
    pass


AUDIO_VOLUME_NOTIFICATION_DATA._fields_ = [
    ('guidEventContext', _GUID),
    ('bMuted', _BOOL),
    ('fMasterVolume', _c_float),
    ('nChannels', _UINT),
    ('afChannelVolumes', (_c_float * 1)),
]
PAUDIO_VOLUME_NOTIFICATION_DATA = _POINTER(AUDIO_VOLUME_NOTIFICATION_DATA)

IID_IAudioEndpointVolumeCallback = _GUID(
    '{657804FA-D6AD-4496-8A60-352752AF4F89}')


class IAudioEndpointVolumeCallback(_IUnknown):
    _iid_ = IID_IAudioEndpointVolumeCallback
    _methods_ = [
        _COMMETHOD([], _HRESULT, 'OnNotify',
                   (['in'], PAUDIO_VOLUME_NOTIFICATION_DATA, 'pNotify')),
    ]


IID_IAudioEndpointVolume = _GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}')
コード例 #28
0
class IAudioEndpointVolume(_IUnknown):
    _iid_ = _GUID('{5CDF2C82-841E-4546-9722-0CF74078229A}')
    _methods_ = [
        _COMMETHOD(
            [], _HRESULT, 'RegisterControlChangeNotify',
            (['in'], _POINTER(IAudioEndpointVolumeCallback), 'pNotify')),
        _COMMETHOD(
            [], _HRESULT, 'UnregisterControlChangeNotify',
            (['in'], _POINTER(IAudioEndpointVolumeCallback), 'pNotify')),
        _COMMETHOD(
            [],
            _HRESULT,
            'GetChannelCount',
            (['out', 'retval'], _POINTER(_UINT), 'pnChannelCount'),
        ),
        _COMMETHOD([], _HRESULT, 'SetMasterVolumeLevel',
                   (['in'], _c_float, 'fLevelDB'),
                   (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT, 'SetMasterVolumeLevelScalar',
                   (['in'], _c_float, 'fLevelDB'),
                   (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT, 'GetMasterVolumeLevel',
                   (['out', 'retval'], _POINTER(_c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT, 'GetMasterVolumeLevelScalar',
                   (['out', 'retval'], _POINTER(_c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT, 'SetChannelVolumeLevel',
                   (['in'], _UINT, 'nChannel'), (['in'], _c_float, 'fLevelDB'),
                   (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT, 'SetChannelVolumeLevelScalar',
                   (['in'], _UINT, 'nChannel'), (['in'], _c_float, 'fLevelDB'),
                   (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT, 'GetChannelVolumeLevel',
                   (['in'], _UINT, 'nChannel'),
                   (['out', 'retval'], _POINTER(_c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT, 'GetChannelVolumeLevelScalar',
                   (['in'], _UINT, 'nChannel'),
                   (['out', 'retval'], _POINTER(_c_float), 'pfLevelDB')),
        _COMMETHOD([], _HRESULT, 'SetMute', (['in'], _BOOL, 'bMute'),
                   (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT, 'GetMute',
                   (['out', 'retval'], _POINTER(_BOOL), 'pbMute')),
        _COMMETHOD(
            [],
            _HRESULT,
            'GetVolumeStepInfo',
            (['out', 'retval'], _POINTER(_UINT), 'pnStep'),
            (['out', 'retval'], _POINTER(_UINT), 'pnStepCount'),
        ),
        _COMMETHOD([], _HRESULT, 'VolumeStepUp',
                   (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD([], _HRESULT, 'VolumeStepDown',
                   (['in'], _POINTER(_GUID), 'pguidEventContext')),
        _COMMETHOD(
            [], _HRESULT, 'QueryHardwareSupport',
            (['out', 'retval'], _POINTER(_DWORD), 'pdwHardwareSupportMask')),
        _COMMETHOD(
            [], _HRESULT, 'GetVolumeRange',
            (['out', 'retval'], _POINTER(_c_float), 'pfLevelMinDB'),
            (['out', 'retval'], _POINTER(_c_float), 'pfLevelMaxDB'),
            (['out', 'retval'], _POINTER(_c_float), 'pfVolumeIncrementDB')),
    ]
コード例 #29
0
ファイル: egl.py プロジェクト: Zulko/vispy
EGL_CORE_NATIVE_ENGINE = 0x305B

# EGL 1.2 tokens renamed for consistency in EGL 1.3
EGL_COLORSPACE = EGL_VG_COLORSPACE
EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT
EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB
EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR
EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE
EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE


## The functions

_lib.eglGetDisplay.argtypes = _c_int,
_lib.eglGetDisplay.restype = c_void_p
_lib.eglInitialize.argtypes = c_void_p, _POINTER(_c_int), _POINTER(_c_int)
_lib.eglTerminate.argtypes = c_void_p,
_lib.eglChooseConfig.argtypes = (c_void_p, _POINTER(_c_int),
                                 _POINTER(c_void_p), _c_int, _POINTER(_c_int))
_lib.eglCreateWindowSurface.argtypes = (c_void_p, c_void_p,
                                        c_void_p, _POINTER(_c_int))
_lib.eglCreatePbufferSurface.argtypes = (c_void_p, c_void_p, _POINTER(_c_int))
_lib.eglCreateContext.argtypes = c_void_p, c_void_p, c_void_p, _POINTER(_c_int)
_lib.eglMakeCurrent.argtypes = (c_void_p,) * 4
_lib.eglSwapBuffers.argtypes = (c_void_p,) * 2
_lib.eglDestroySurface.argtypes = (c_void_p,) * 2
_lib.eglQueryString.argtypes = (c_void_p, _c_int)
_lib.eglQueryString.restype = c_char_p


def eglGetError():