Can't set default input or output (error: cannot assign to property: 'defaultInputDevice' is a get-only property)
technicalpickles opened this issue · comments
The documentation suggests:
Getting/setting default input, output and system device (see SimplyCoreAudio)
But I haven't a way to get this to work yet. When I try, I get error: cannot assign to property: 'defaultInputDevice' is a get-only property
Simplest way to reproduce:
let simplyCA = SimplyCoreAudio()
simplyCA.defaultInputDevice = simplyCA.defaultInputDevice
device.isDefaultInputDevice = true
That is helpful, thanks! Is there a better way to find a device to set as default than something like this?
let device = simplyCA.allInputDevices.first(where: { $0.name == deviceName })
device?.isDefaultInputDevice = true
It seems like there should be a helper for it, but also... it's easy enough.
If you're making a selector you should use the UID rather than the name. A name isn't necessarily unique whereas the device UID is.
Good point.
I think my request at this point is an example in the docs for setting the default input/output.
sure, that seems right!
added a few more device examples to the overview here: https://github.com/rnine/SimplyCoreAudio#readme