Hello.
When trying to add more than 8 nodes to the graph, the AUGraphInitialize function returns an error code -10877 (kAudioUnitErr_InvalidElement).
What is wrong? How can I debug this InvalidElement?
var acd: AudioComponentDescription = AudioComponentDescription()
acd.componentManufacturer = kAudioUnitManufacturer_Apple
acd.componentType = kAudioUnitType_MusicDevice
acd.componentSubType = kAudioUnitSubType_MIDISynth
var units = []
for i in 0..<number {
var instrumentNode = AUNode()
AUGraphAddNode(graph, &acd, &instrumentNode)
var instrumentUnit: AudioUnit!
AUGraphNodeInfo(graph, instrumentNode, nil, &instrumentUnit)
AUGraphConnectNodeInput(graph, instrumentNode, 0, mixerNode, UInt32(i))
units.append(instrumentUnit)
}
AUGraphConnectNodeInput(graph, mixerNode, 0, outNode, 0)
AUGraphInitialize(graph)
AUGraphStart(graph)