4

How do I send and receive network MIDI data in iOS? I am able to resolve the server using bonjour and apply the service to a MIDI connection, but I don't know where to go from there. The documentation seems to be lacking, and there's not much information online.

TigerhawkT3
  • 48,464
  • 6
  • 60
  • 97
ultra
  • 329
  • 1
  • 4
  • 15

1 Answers1

9

Essentially, you need to connect to the session via Bonjour as you have done, and within your iOS app:

  • Create a client using MIDIClientCreate
  • Create an input port using MIDIInputPortCreate
    • This takes a pointer to a C function that will be called when MIDI data is received
    • You need to connect it to the MIDINetworkSession's defaultSession using MIDIPortConnectSource - connect it to the sourceEndpoint
  • Create an output port using MIDIOutputPortCreate
    • You can send data to the network session using MIDISend - send the packets to to the MIDINetworkSession defaultSession's destinationEndpoint

I wrote a few blog posts about this a while back, see here for source code etc.

Part 1

Part 2

Part 3

Simon Lawrence
  • 564
  • 2
  • 8
  • i should have reported the answer (same answer as yours) back here. i'm the one who was conversing with you on your blog. thanks so much for the code. it helped me with using settings and the settings view controller as well as midi. i added sysex support with success. – ultra Feb 23 '13 at 12:05