def print_devices(InOrOut): for loop in range(pypm.CountDevices()): interf, name, inp, outp, opened = pypm.GetDeviceInfo(loop) if ((InOrOut == INPUT) & (inp == 1) | (InOrOut == OUTPUT) & (outp == 1)): print loop, name, " ", if (inp == 1): print "(input) ", else: print "(output) ", if (opened == 1): print "(opened)" else: print "(unopened)"
def get_device_info(an_id): """ returns information about a midi device pygame.midi.get_device_info(an_id): return (interf, name, input, output, opened) interf - a text string describing the device interface, eg 'ALSA'. name - a text string for the name of the device, eg 'Midi Through Port-0' input - 0, or 1 if the device is an input device. output - 0, or 1 if the device is an output device. opened - 0, or 1 if the device is opened. If the id is out of range, the function returns None. """ _check_init() return _pypm.GetDeviceInfo(an_id)
def get_device_info(an_id): """ returns (interf, name, input, output, opened) If the id is out of range, the function returns None. """ return pypm.GetDeviceInfo(an_id)
def get_devices(): for i in range(pypm.CountDevices()): yield pypm.GetDeviceInfo(i)