You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Returns a string containing the unique ID of the port.
Manufacturer
string
get
Returns a string containing the manufacturer of the port.
Name
string
get
Returns a string containing the system name of the port.
Type
string
get
Returns a string containing the type of the port
Version
string
get
Returns a string containing the version of the port.
State
string
get
Returns a string containing the state of the port
Connection
string
get
Returns a string containing the connection state of the port
Methods
Method
Return Type
Description
Open()
Task
Makes the MIDI device connected to this MIDIPort explicitly available, and returns a Promise which resolves once access to the port has been successful.
Close()
Task
Makes the MIDI device connected to this MIDIPort unavailable, changing the state from "open" to "closed". This returns a Promise which resolves once the port has been closed.
Events
Event
Type
Description
OnStateChange
ActionEvent<MIDIConnectionEvent>
Called when an existing port changes its state or connection.
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<MIDIPort>(...) or constructor new MIDIPort(...)
List ports and their information
functionlistInputsAndOutputs(midiAccess){for(constentryofmidiAccess.inputs){constinput=entry[1];console.log(`Input port [type:'${input.type}'] id:'${input.id}' manufacturer: '${input.manufacturer}' name: '${input.name}' version: '${input.version}'`,);}for(constentryofmidiAccess.outputs){constoutput=entry[1];console.log(`Output port [type:'${output.type}'] id: '${output.id}' manufacturer: '${output.manufacturer}' name: '${output.name}' version: '${output.version}'`,);}}