MIDIHandler

public final class MIDIHandler

Undocumented

  • Undocumented

    Declaration

    Swift

    public var midiControllerList: [String]
  • Singleton of MIDIHandler

    Declaration

    Swift

    public static var shared: MIDIHandler
  • Initialization, read controller list from file

    Declaration

    Swift

    public init()
  • Convert second to nanosecond, MIDI Timestamp is in nanosecond

    Declaration

    Swift

    public static func secondToNanoSecond(second: UInt64) -> UInt64
  • Create a virtual MIDI source, for outputing midi data to DAWs

    Declaration

    Swift

    public func configDevice()
  • Send a midi packet

    Declaration

    Swift

    public func sendMIDIEvent(event: MIDIEvent, channel: UInt8 = 0, data1: UInt8, data2: UInt8)

    Parameters

    event

    See MIDIEvent Enum

    channel

    MIDI Channel number 0-15

    data1

    2nd Byte of a MIDI message

    data2

    3nd Byte of a MIDI Message

  • Send a pair of note on & note off message

    Declaration

    Swift

    public func sendNote(channel: UInt8 = 0, noteNumber: UInt8, velocity: UInt8, duration: NoteLength)

    Parameters

    channel

    MIDI Channel number 0-15

    noteNumber

    0-127

    velocity

    0-127

    duration

    See NoteLength Enum

  • Send a note on message

    Declaration

    Swift

    public func sendNoteOn (channel: UInt8 = 0, noteNumber: UInt8, velocity: UInt8)

    Parameters

    channel

    MIDI Channel number 0-15

    noteNumber

    0-127

    velocity

    0-127

  • Send a note off message

    Declaration

    Swift

    public func sendNoteOff (channel: UInt8 = 0, noteNumber: UInt8)

    Parameters

    channel

    MIDI Channel number 0-15

    noteNumber

    0-127

  • Send a pitchbend message

    Declaration

    Swift

    public func sendPitchBend (channel: UInt8 = 0, value: UInt8)

    Parameters

    channel

    MIDI Channel number 0-15

    value

    0-127, 64 is pitchbend in the middle position

  • Send a aftertouch message

    Declaration

    Swift

    public func sendAfterTouch (channel: UInt8 = 0, value: UInt8)

    Parameters

    channel

    MIDI Channel number 0-15

    value

    0-127

  • Send a midi control message

    Declaration

    Swift

    public func sendControlMessage(channel: UInt8 = 0, cc: UInt8, value: UInt8)

    Parameters

    channel

    MIDI Channel number 0-15

    cc

    controller number 0-127

    value

    0-127

  • Mute all notes on a channel

    Declaration

    Swift

    public func sendAllNoteOff(channel: UInt8 = 0)
  • MIDI Flush

    Declaration

    Swift

    public func flushMIDI()
  • Reset pitchbend to middle position

    Declaration

    Swift

    public func resetPitchBend()