Class MIDIPort
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The MIDIPort interface of the 'Web MIDI API' represents a MIDI input or output port.
[Value("MIDIPort")]
public class MIDIPort : EventTarget
- Inheritance
-
MIDIPort
- Derived
- Inherited Members
Remarks
A MIDIPort instance is created when a new MIDI device is connected. Therefore it has no constructor.
Constructors
MIDIPort()
public MIDIPort()
Properties
Connection
The connection read-only property of the MIDIPort interface returns the connection state of the port.
[Value("connection")]
public MIDIPortConnectionState Connection { get; }
Property Value
- MIDIPortConnectionState
Returns a string containing the connection state of the port, one of:
Remarks
Id
The id read-only property of the MIDIPort interface returns the unique ID of the port.
[Value("id")]
public string Id { get; }
Property Value
- string
A string containing an ID for the port.
Remarks
Manufacturer
The manufacturer read-only property of the MIDIPort interface returns the manufacturer of the port.
[Value("manufacturer")]
public string? Manufacturer { get; }
Property Value
- string
A string containing the manufacturer of the port.
Remarks
Name
The name read-only property of the MIDIPort interface returns the system name of the port.
[Value("name")]
public string? Name { get; }
Property Value
- string
A string containing the system name of the port.
Remarks
Onstatechange
[Value("onstatechange")]
public EventHandlerNonNull Onstatechange { get; set; }
Property Value
State
The state read-only property of the MIDIPort interface returns the state of the port.
[Value("state")]
public MIDIPortDeviceState State { get; }
Property Value
- MIDIPortDeviceState
A string containing the state of the port, one of:
Remarks
Type
The type read-only property of the MIDIPort interface returns the type of the port, indicating whether this is an input or output MIDI port.
[Value("type")]
public MIDIPortType Type { get; }
Property Value
- MIDIPortType
A string containing the type of the port, one of:
Remarks
Version
The version read-only property of the MIDIPort interface returns the version of the port.
[Value("version")]
public string? Version { get; }
Property Value
- string
A string containing the version of the port.
Remarks
Methods
Close()
The close() method of the MIDIPort interface makes the access to the MIDI device connected to this MIDIPort unavailable.
[Value("close")]
public Task<MIDIPort> Close()
Returns
Remarks
If the port is successfully closed a new MIDIConnectionEvent is queued to the MIDIPort MIDIPort.Statechange and MIDIAccess MIDIAccess.Statechange events, and the Connection property is changed to "closed".
Open()
The open() method of the MIDIPort interface makes the MIDI device connected to this MIDIPort explicitly available.
[Value("open")]
public Task<MIDIPort> Open()
Returns
Remarks
If the port is successfully opened a new MIDIConnectionEvent is queued to the MIDIPort MIDIPort.Statechange and MIDIAccess MIDIAccess.Statechange events, and the Connection property is changed to "open".
If the port is already open when this method is called, then the promise will resolve successfully.