swift - Is there a way to tell if a MIDI-Device is connected via USB on iOS? -
i'm using coremidi receive messages midi-keyboard via camera connection kit on ios-devices. app pitch recognition. want following functionality automatic:
by default use microphone (already implemented), if midi-keyboard connected use instead.
it's find out how tell if usb-keyboard using default driver. ask device called "usb-midi":
private func getusbdevicereference() -> midideviceref? { index in 0..<midigetnumberofdevices() { let device = midigetdevice(index) var name : unmanaged<cfstring>? midiobjectgetstringproperty(device, kmidipropertyname, &name) if name!.takeretainedvalue() string == "usb-midi" { return device } } return nil }
but unfortunately there usb-keyboards use custom driver. how can tell if i'm looking @ 1 of these? standard bluetooth- , network-devices seem online. if wifi , bluetooth turned of on device (strange?).
Comments
Post a Comment