Skip to content

Latest commit

 

History

History
42 lines (31 loc) · 1.48 KB

File metadata and controls

42 lines (31 loc) · 1.48 KB

MIDIInput

Namespace: SpawnDev.SpawnJS.JSObjects
Inherits: MIDIPort
Source: JSObjects/MIDIInput.cs
MDN Reference: MIDIInput on MDN

The MIDIInput interface of the Web MIDI API receives messages from a MIDI input port. https://developer.mozilla.org/en-US/docs/Web/API/MIDIInput

Constructors

Signature Description
MIDIInput(SpawnJSObjectReference _ref) Deserialization constructor

Events

Event Type Description
OnMIDIMessage ActionEvent<MIDIMessageEvent> Fired when the current port receives a MIDI message.

Examples

SpawnDev.SpawnJS Mapping Note: The JavaScript examples below show the standard Web API usage. In SpawnDev.SpawnJS, the same API is available with C# conventions:

  • Properties and methods use PascalCase (e.g., readyState becomes ReadyState)
  • Events use ActionEvent with +=/-= (e.g., addEventListener("click", fn) becomes OnClick += handler)
  • Async methods return Task<T> instead of Promise<T>
  • Objects should be disposed with using statements
  • Access via JS.Get<MIDIInput>(...) or constructor new MIDIInput(...)
inputs.forEach((input) => {
  console.log(input.name); /* inherited property from MIDIPort */
  input.onmidimessage = (message) => {
    console.log(message.data);
  };
});

See full example on MDN