CoreMIDI terminology is already super confusing and badly documented, and Audiokit isn't helping as much as I wished it might.
As far as I can tell, each application is supposed to have one instance of a midi client reference (MIDIClientRef
). Audiokit has the AKMIDI
class that creates a new client reference for each AKMIDI
instance, and instances are being created left, right and center (including the initialization of each AKMIDIInstrument
, AKCallbackInstrument
and AKMIDISampler
instance). All of these also create endpoints with hardcoded names in their built-in constructors so I don't see how I'm supposed to make ones that have proper names.
The top price goes to AKMIDISampler
, whose source first says:
/// Initialize the MIDI Sampler
public override init() {
super.init()
enableMIDI()
}
And then on the following few lines:
/// Enable MIDI input from a given MIDI client
/// This is not in the init function because it must be called AFTER you start AudioKit
///
/// [snipped parameter comments for brevity]
open func enableMIDI(_ midiClient: MIDIClientRef = AKMIDI().client, name: String = "MIDI Sampler")
(Note that it IS in the init function)
I would be super happy to either hear some clarification about general usage guidelines (do I need to override everything?) or links to documentation/articles explaining this in more detail.
We just fixed that issue with #1141 PR. https://github.com/AudioKit/AudioKit/pull/1141/files
You can point to the develop branch on your podfile until the next release.
pod 'AudioKit', :git => 'https://github.com/AudioKit/AudioKit.git', :branch => 'develop'