Options
All
  • Public
  • Public/Protected
  • All
Menu

Directly speaks to Midi devices via WebMidi Api and is informed when devices were dis-/connected.

Hierarchy

  • MidiHandler

Index

Constructors

constructor

Properties

Private connected

connected: boolean = false

Indicates whether the class was already connected to the WebMidi Api.

Private inputDevices

inputDevices: string[] = []

A list of Midi input device names.

Private outputDevices

outputDevices: string[] = []

A list of Midi output device names.

Accessors

inputs

  • get inputs(): string[]
  • A list of Midi input device names.

    Returns string[]

outputs

  • get outputs(): string[]
  • A list of Midi output device names.

    Returns string[]

Methods

connect

  • connect(renderCallback: () => void): void
  • Connects to the WebMidi Api and registers callback that are triggered whenever a device was dis-/connected.

    Parameters

    • renderCallback: () => void

      Function that is called when the view has to be rerendered.

        • (): void
        • Returns void

    Returns void

disconnect

  • disconnect(): void
  • Disconnects from the WebMidi Api.

    Returns void

isConnected

  • isConnected(): boolean
  • Indicates whether the class was already connected to the WebMidi Api.

    Returns boolean

    True if connected.

send

  • send(value: number, deviceName: string, channel: number, controller: number): void
  • Verifies and sends all values needed to send a message via the WebMidi Api.

    Parameters

    • value: number

      The value that is send. Has to be in range [0, 127].

    • deviceName: string

      The device name of a connected Midi device. Has to be registered in the WebMidi Api.

    • channel: number

      The channel the Midi device uses. In the historical real world, a Midi cable could be used to send signals to up to 16 instruments. That's why this value has to be in range [1, 16].

    • controller: number

      The controller the Midi device uses. In the historical real world, this could be a knob or a slider or a key on an instrument. Has to be in range [0, 119].

    Returns void

updateDevices

  • updateDevices(renderCallback: () => void): void
  • Routine that is called whenever devices changed.

    Parameters

    • renderCallback: () => void

      Function that is called to rerender the view.

        • (): void
        • Returns void

    Returns void

Generated using TypeDoc