AKMIDI

open class AKMIDI

MIDI input and output handler

You add MIDI listeners like this:

var midiIn = AKMIDI()
midi.openInput()
midi.addListener(someClass)

…where someClass conforms to the AKMIDIListener protocol

You then implement the methods you need from AKMIDIListener and use the data how you need.

  • MIDI Client Reference

    Declaration

    Swift

    open var client = MIDIClientRef()
  • Virtual MIDI Input destination

    Declaration

    Swift

    open var virtualInput = MIDIPortRef()
  • Virtual MIDI output

    Declaration

    Swift

    open var virtualOutput = MIDIPortRef()
  • Array of MIDI Endpoints

    Declaration

    Swift

    open var endpoints = [String: MIDIEndpointRef]()
  • Initialize the AKMIDI system

    Declaration

    Swift

    public init()
  • Create set of virtual MIDI ports

    Declaration

    Swift

    open func createVirtualPorts(_ uniqueID: Int32 = 2_000_000, name: String? = nil)
  • Create a virtual MIDI input port

    Declaration

    Swift

    open func createVirtualInputPort(_ uniqueID: Int32 = 2_000_000, name: String? = nil)
  • Create a virtual MIDI output port

    Declaration

    Swift

    open func createVirtualOutputPort(_ uniqueID: Int32 = 2_000_000, name: String? = nil)
  • Discard all virtual ports

    Declaration

    Swift

    open func destroyVirtualPorts()
  • Array of input names

    Declaration

    Swift

    public var inputNames: [String]
  • Add a listener to the listeners

    Declaration

    Swift

    public func addListener(_ listener: AKMIDIListener)
  • Remove all listeners

    Declaration

    Swift

    public func clearListeners()
  • Add a transformer to the transformers list

    Declaration

    Swift

    public func addTransformer(_ transformer: AKMIDITransformer)
  • Remove all transformers

    Declaration

    Swift

    public func clearTransformers()
  • Open a MIDI Input port

    Declaration

    Swift

    public func openInput(_ namedInput: String = "")

    Parameters

    namedInput

    String containing the name of the MIDI Input

  • Close a MIDI Input port

    Declaration

    Swift

    public func closeInput(_ namedInput: String = "")

    Parameters

    namedInput

    String containing the name of the MIDI Input

  • Close all MIDI Input ports

    Declaration

    Swift

    public func closeAllInputs()
  • Array of destination names

    Declaration

    Swift

    public var destinationNames: [String]
  • Open a MIDI Output Port

    Destination name (string) can be empty for some hardware device; So optional string is better for checking and targeting the device.

    Declaration

    Swift

    public func openOutput(_ namedOutput: String? = nil)

    Parameters

    namedOutput

    String containing the name of the MIDI Input

  • Send Message with data

    Declaration

    Swift

    public func sendMessage(_ data: [MIDIByte])
  • Clear MIDI destinations

    Declaration

    Swift

    public func clearEndpoints()
  • Send Messsage from MIDI event data

    Declaration

    Swift

    public func sendEvent(_ event: AKMIDIEvent)
  • Send a Note On Message

    Declaration

    Swift

    public func sendNoteOnMessage(noteNumber: MIDINoteNumber,
                                      velocity: MIDIVelocity,
                                      channel: MIDIChannel = 0)
  • Send a Note Off Message

    Declaration

    Swift

    public func sendNoteOffMessage(noteNumber: MIDINoteNumber,
                                       velocity: MIDIVelocity,
                                       channel: MIDIChannel = 0)
  • Send a Continuous Controller message

    Declaration

    Swift

    public func sendControllerMessage(_ control: MIDIByte, value: MIDIByte, channel: MIDIChannel = 0)