def _get_cap(self): if self.captureDev != None: return self.parse( alc.alcGetString(self.captureDev, alc.ALC_CAPTURE_DEVICE_SPECIFIER)) else: return None
def get_extensions(): extensions = alc.alcGetString(_device, alc.ALC_EXTENSIONS) # Check for null pointer if not ctypes.cast(extensions, ctypes.c_void_p).value: return [] if sys.platform == 'darwin': return ctypes.cast(extensions, ctypes.c_char_p).value.split(' ') else: return _split_nul_strings(extensions)
def __init__(self): #load device/context/listener self.device = alc.alcOpenDevice(None) self.context = alc.alcCreateContext(self.device, None) alc.alcMakeContextCurrent(self.context) alc.alcProcessContext(self.context) #get list of capture devices self.cap_devices = self.parse( alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER)) #capture device container self.captureDev = None #main buffer self.samplescaptured = ''
def get_extensions(): extensions = alc.alcGetString(_device, alc.ALC_EXTENSIONS) if sys.platform == "darwin": return ctypes.cast(extensions, ctypes.c_char_p).value.split(" ") else: return _split_nul_strings(extensions)
i += 1 s = s[:i - 1] return s.split('\0') if __name__ == '__main__': op = optparse.OptionParser() op.add_option('-d', '--device', dest='device', help='use device DEVICE', metavar='DEVICE') (options, args) = op.parse_args(sys.argv[1:]) default_device = ctypes.cast( alc.alcGetString(None, alc.ALC_DEFAULT_DEVICE_SPECIFIER), ctypes.c_char_p).value capture_default_device = ctypes.cast( alc.alcGetString(None, alc.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER), ctypes.c_char_p).value print 'Default device: %s' % default_device print 'Default capture device: %s' % capture_default_device if alc.alcIsExtensionPresent(None, 'ALC_ENUMERATION_EXT'): # Hmm, actually not allowed to pass NULL to alcIsExtension present.. # how is this supposed to work? devices = split_nul_strings( alc.alcGetString(None, alc.ALC_DEVICE_SPECIFIER)) capture_devices = split_nul_strings( alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))
def get_devices(self): return self.parse( alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))
else: nul = True else: nul = False i += 1 s = s[:i - 1] return s.split('\0') if __name__ == '__main__': op = optparse.OptionParser() op.add_option('-d', '--device', dest='device', help='use device DEVICE', metavar='DEVICE') (options, args) = op.parse_args(sys.argv[1:]) default_device = ctypes.cast( alc.alcGetString(None, alc.ALC_DEFAULT_DEVICE_SPECIFIER), ctypes.c_char_p).value capture_default_device = ctypes.cast( alc.alcGetString(None, alc.ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER), ctypes.c_char_p).value print 'Default device: %s' % default_device print 'Default capture device: %s' % capture_default_device if alc.alcIsExtensionPresent(None, 'ALC_ENUMERATION_EXT'): # Hmm, actually not allowed to pass NULL to alcIsExtension present.. # how is this supposed to work? devices = split_nul_strings( alc.alcGetString(None, alc.ALC_DEVICE_SPECIFIER)) capture_devices = split_nul_strings( alc.alcGetString(None, alc.ALC_CAPTURE_DEVICE_SPECIFIER))