I am trying to list all Input Channels for a USB Audio Device. Currently I am testing with a USB Headset which has 2 channels in and 2 out (I have confirmed this by checking the device in Audio Midi Setup) when I run the following code I only get one port. I think I need to create an AVCaptureConnection but I'm starting to get lost with all the different approaches I've found online.
Could someone help me out with a basic script that tells me how many channels I have on a USB Audio Input Device. Once I have achieved that I will want to monitor the incoming levels however I can figure that bit out
let dev = AVCaptureDevice.default(for: AVMediaType.audio)
let input = (try? AVCaptureDeviceInput.init(device: dev!))!
let t = AVCaptureSession.init()
t.addInput(input)
print(t.inputs[0].ports.count) //Prints 1