BLE MIDI talk to system #207
Replies: 2 comments
-
I haven't spent much time with BLE, and I'm not sure if I have a BLE MIDI device to test out. So I'm not able to give a ton of advice at this point. For the longest time, all Bluetooth MIDI connections were created and connected solely by the end-user in Audio MIDI Setup and then you just utilize the MIDI endpoints like any other endpoints in the system. There was nothing that could be done programmatically by a developer in that area. (Perhaps you can handle it by manually connecting and handling raw MIDI data as you say, but I haven't traversed those waters.) It seems that as of macOS 13, Apple has added the OS behavior of auto-reconnecting paired BLE peripherals when powered on. Whether this means it auto-creates MIDI endpoints at the same time, I'm not totally sure as the docs are a little scant/vague on that. We'd want to probably just test it in practise. My guess is that you're doing more work than you need/should. I don't think you should be handling raw bytes, manually creating ports, or and using the MIDI1Parser. But again, I've not spent a lot of time with BT/BLE. It appears that MIDIBluetoothDriverActivateAllConnections() would create the MIDI endpoints after you've connected using Core Bluetooth. So no raw data or manual MIDI port creation necessary. I'd need some time to investigate it further, but won't likely be able to give it time until end of April. |
Beta Was this translation helpful? Give feedback.
-
I tried some more, with no luck. Nothing happens with MIDIBluetoothDriverActivateAllConnections(). For now, until I figure it out, I will just continue using my hack. Interestingly, if I let my computer go to sleep while a device is connected, it might be transferred from being connected in my app to being connected in MIDI Studio. Then I have to open up MIDI studio and disconnect it before I again can scan and connect to the device in my app. There is something weird going on here |
Beta Was this translation helpful? Give feedback.
-
Hi!
I can see there has been a couple of other discussions about Bluetooth connections, but I dont hink my case is the same.
Not entirely sure if I understand how things is connected under the hood. Basically I am creating a app for macOS which handles BLE MIDI connections. This is what I have done previously:
I can see there is some support for Bluetooth in MidiKit (and CoreMIDI) so I assume what I am doing is not taking advantage of infrastructure.
I have briefly looked into the function
MIDIBluetoothDriverActivateAllConnections()
which to my understanding will figure out by itself which bluetooth devices are MIDI devices and map these to system midi devices somehow. But I never got it working.Any recommendations what to look into and try from here? I could just keep on going with the current approach, timestamp removal is not complete yet. But I assume there are nuances which also make the native stuff better, like latency, maybe it takes into account the timestamp and so on.
Beta Was this translation helpful? Give feedback.
All reactions