import sounddevice as sd

print("🎤 正在查询可用的音频设备...\n")
devices = sd.query_devices()

for i, device in enumerate(devices):
    print(f"设备 ID {i}: {device['name']} - 输入通道: {device['max_input_channels']}")

# 只显示支持 WASAPI 环回录音的设备
wasapi_devices = [d for d in devices if "loopback" in d["name"].lower()]
if wasapi_devices:
    print("\n✅ 发现 WASAPI '环回录音' 设备：")
    for d in wasapi_devices:
        print(f" - {d['name']}")
else:
    print("\n❌ 没有找到 'WASAPI 环回录音' 设备，请尝试手动启用或安装 Virtual Cable。")