Example #1
0
    def get_real_index(device_index: [int, None]) -> int:
        if device_index is not None:
            assert isinstance(device_index,
                              int), "Device index must be None or an integer"
            count = Devices.get_device_count()
            msg = ("Device index out of range ({} devices available; "
                   "device index should be between 0 and {} inclusive)")
            assert 0 <= device_index < count, msg.format(count, count - 1)
            return device_index

        return pa.get_default_input_device()
Example #2
0
    def get_default_input_device_info(self):
        """
        Return the default input Device parameters as a
        dictionary. The keys of the dictionary mirror the data fields
        of PortAudio's ``PaDeviceInfo`` structure.

        :raises IOError: No default input device available.
        :rtype: dict
        """

        device_index = pa.get_default_input_device()
        return self.get_device_info_by_index(device_index)
Example #3
0
    def get_default_input_device_info(self):
        """
        Return the default input Device parameters as a
        dictionary. The keys of the dictionary mirror the data fields
        of PortAudio's ``PaDeviceInfo`` structure.

        :raises IOError: No default input device available.
        :rtype: dict
        """

        device_index = pa.get_default_input_device()
        return self.get_device_info_by_index(device_index)
Example #4
0
print "\nDevices:\n========"

for i in range(max_devs):
    devinfo = p.get_device_info(i)
    print "Number                   : ", i
    print "Name                     : ", devinfo.name
    print "hostApi Index            : ",  devinfo.hostApi
    print "maxInputChannels         : ", devinfo.maxInputChannels
    print "maxOutputChannels        : ", devinfo.maxOutputChannels
    print "defaultLowInputLatency   : ", devinfo.defaultLowInputLatency
    print "defaultLowOutputLatency  : ", devinfo.defaultLowOutputLatency
    print "defaultHighInputLatency  : ", devinfo.defaultHighInputLatency
    print "defaultHighOutputLatency : ", devinfo.defaultHighOutputLatency
    print "defaultSampleRate        : ", devinfo.defaultSampleRate
    print "--------------------------------"

print "\nDefault Devices:\n================"
try:
    print "Input  :", p.get_default_input_device()
except IOError, e:
    print "No Input devices."

try:
    print "Output :", p.get_default_output_device()
except IOError, e:
    print "No Output devices."

p.terminate()