     
     @IBOutlet var noteNumField: UITextField!
     @IBOutlet var noteVelField: UITextField!
+    @IBOutlet var noteChanField: UITextField!
     @IBOutlet var ccField: UITextField!
     @IBOutlet var ccValField: UITextField!
+    @IBOutlet var ccChanField: UITextField!
     @IBOutlet var sysexField: UITextView!
     
     var noteToSend:Int? {

    var velocityToSend:Int? {
        return Int(noteVelField.text!)
    }
    var ccToSend:Int? {
        return Int(ccField.text!)
    }
    var ccValToSend:Int? {
        return Int(ccValField.text!)
    }
    override func viewDidLoad() {
        
        midiOut.openOutput()
        
        //Looks for single or multiple taps.
        let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
        //Uncomment the line below if you want the tap not not interfere and cancel other interactions.
        //tap.cancelsTouchesInView = false
        view.addGestureRecognizer(tap)
    }
    
    
    //Calls this function when the tap is recognized.
    @objc func dismissKeyboard() {
        //Causes the view (or one of its embedded text fields) to resign the first responder status.
        view.endEditing(true)
    }
    
    @IBAction func sendNotePressed(_ sender: UIButton) {
        if noteToSend != nil && velocityToSend != nil {
            print("sending note: \(noteToSend!) - \(velocityToSend!)")
            let event = AKMIDIEvent(noteOn: MIDINoteNumber(noteToSend!), velocity: MIDIVelocity(velocityToSend!), channel: 0)
            midiOut.sendEvent(event)
        }else{
            print("error w note fields")
        }
    }
    @IBAction func sendCCPressed(_ sender: UIButton) {
        if ccToSend != nil && ccValToSend != nil {
            print("sending cc: \(ccToSend!) - \(ccValToSend!)")
            let event = AKMIDIEvent(controllerChange: MIDIByte(ccToSend!), value: MIDIByte(ccValToSend!), channel: 1)
            midiOut.sendEvent(event)
        }else{
            print("error w cc fields")

    }
    
    @IBAction func sendSysexPressed(_ sender: UIButton) {
        if sysexToSend != nil {
            print("sending sysex \(sysexToSend!)")
            var midiBytes = [MIDIByte]()
            for byte in sysexToSend!{
                midiBytes.append(MIDIByte(byte))
            }
            let event = AKMIDIEvent(data: midiBytes)
            midiOut.sendEvent(event)
        }else{
            print("error w sysex")
        }
    }
    
    @IBAction func receiveMIDIButtonPressed(_ sender: UIButton) {
