MCPcopy Index your code
hub / github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI / get_devices

Method get_devices

gui_v1.py:820–855  ·  view source on GitHub ↗

获取设备列表

(self, update: bool = True)

Source from the content-addressed store, hash-verified

818 printt("Infer time: %.2f", total_time)
819
820 def get_devices(self, update: bool = True):
821 """获取设备列表"""
822 if update:
823 sd._terminate()
824 sd._initialize()
825 devices = sd.query_devices()
826 hostapis = sd.query_hostapis()
827 for hostapi in hostapis:
828 for device_idx in hostapi["devices"]:
829 devices[device_idx]["hostapi_name"] = hostapi["name"]
830 input_devices = [
831 f"{d['name']} ({d['hostapi_name']})"
832 for d in devices
833 if d["max_input_channels"] > 0
834 ]
835 output_devices = [
836 f"{d['name']} ({d['hostapi_name']})"
837 for d in devices
838 if d["max_output_channels"] > 0
839 ]
840 input_devices_indices = [
841 d["index"] if "index" in d else d["name"]
842 for d in devices
843 if d["max_input_channels"] > 0
844 ]
845 output_devices_indices = [
846 d["index"] if "index" in d else d["name"]
847 for d in devices
848 if d["max_output_channels"] > 0
849 ]
850 return (
851 input_devices,
852 output_devices,
853 input_devices_indices,
854 output_devices_indices,
855 )
856
857 def set_devices(self, input_device, output_device):
858 """设置输出设备"""

Callers 4

loadMethod · 0.95
launcherMethod · 0.95
event_handlerMethod · 0.95
set_devicesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected