MidiInPort
MidiInPort
MidiInPort
MidiInPort
Class
Definition
Represents a port used to receive MIDI messages from a MIDI device.
public : sealed class MidiInPort : IMidiInPort, IClosablepublic sealed class MidiInPort : IMidiInPort, IDisposablePublic NotInheritable Class MidiInPort Implements IMidiInPort, IDisposable// You can use this class in JavaScript.
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Remarks
If the MidiInPort becomes disconnected for any reason, it should be disposed and a new one created to continue receiving messages.
Properties
DeviceId DeviceId DeviceId DeviceId
Gets the id of the device that was used to initialize the MidiInPort.
public : PlatForm::String DeviceId { get; }public string DeviceId { get; }Public ReadOnly Property DeviceId As string// You can use this property in JavaScript.
- Value
- PlatForm::String string string string
The ID of the device.
Methods
Close() Close() Close() Close()
Closes the MidiInPort.
public : void Close()This member is not implemented in C#This member is not implemented in VB.Net// You can use this method in JavaScript.
Dispose() Dispose() Dispose() Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
This member is not implemented in C++void Dispose()Sub Disposevoid Dispose()
FromIdAsync(String) FromIdAsync(String) FromIdAsync(String) FromIdAsync(String)
Creates a MidiInPort object for the specified device.
public : static IAsyncOperation<MidiInPort> FromIdAsync(PlatForm::String deviceId)public static IAsyncOperation<MidiInPort> FromIdAsync(String deviceId)Public Static Function FromIdAsync(deviceId As String) As IAsyncOperation( Of MidiInPort )// You can use this method in JavaScript.
- deviceId
- PlatForm::String String String String
The device ID, which can be obtained by enumerating the devices on the system Windows.Devices.Enumeration.DeviceInformation.FindAllAsync.
The asynchronous operation. Upon completion, IAsyncOperation.GetResults returns a MidiInPort object.
Remarks
To enumerate the MidiInPort objects on the system, pass the query string provided by GetDeviceSelector to Windows.Devices.Enumeration.DeviceInformation.FindAllAsync.
Suggested times to attempt to create a MidiInPort are on any sort of app activation or user interaction. If a function call on a MidiInPort fails, or if a message received from a MidiInPort is invalid, do not try to recreate the port immediately.
GetDeviceSelector() GetDeviceSelector() GetDeviceSelector() GetDeviceSelector()
Gets a query string that can be used to enumerate all MidiInPort objects on the system.
public : static PlatForm::String GetDeviceSelector()public static string GetDeviceSelector()Public Static Function GetDeviceSelector() As string// You can use this method in JavaScript.
The query string used to enumerate the MidiInPort objects on the system.
Remarks
To enumerate the MidiInPort objects on the system, pass the query string provided by this method to Windows.Devices.Enumeration.DeviceInformation.FindAllAsync.
Events
MessageReceived MessageReceived MessageReceived MessageReceived
Occurs when the MidiInPort receives data.
public : event TypedEventHandler MessageReceived<MidiInPort, MidiMessageReceivedEventArgs>public event TypedEventHandler MessageReceived<MidiInPort, MidiMessageReceivedEventArgs>Public Event MessageReceived<MidiInPort, MidiMessageReceivedEventArgs>// You can use this event in JavaScript.
Remarks
Apps should subscribe to this event to handle the input messages.
If accessing any part of the message results in an exception, it can be assumed that the MidiInPort has been disconnected from the device.