I'd like to connect my electric guitar to my app. I have hardware (the Line6 Sonic Port) that passes the audio from my guitar into my iPhone. I've figured out how to get audio playing out to my headphones, but it's audio coming from my headphone mic, not the Lightning Port input. How do I programmatically find the Lightning Port audio input, instead of getting audio via the headphone mic?
Here's what I've tried so far:
self.audioEngine = AVAudioEngine()
let input = self.audioEngine.inputNode
let mixer = self.audioEngine.mainMixerNode
let output = self.audioEngine.outputNode
println("number of inputs: \(input.numberOfInputs)")
self.audioEngine.inputNode.installTapOnBus(0, bufferSize: 128, format: input.inputFormatForBus(0)) { (buffer, time) -> Void in
//
}
self.audioEngine.connect(input, to: mixer, format: input.inputFormatForBus(0))
self.audioEngine.connect(mixer, to: output, format: mixer.inputFormatForBus(0))
self.audioEngine.prepare()
self.audioEngine.startAndReturnError(nil)
When I do this, I see the following in my console from my println:
number of inputs: 1
I think this means that there's only 1 input that my input node can find - right? Or no? How can I connect to the lightning port?
For a quick illustration, here is the hardware that I'm using:
Aucun commentaire:
Enregistrer un commentaire