Represents a MIDI in device.
More...
|
| MidiIn (int deviceNo) |
| Opens a specified MIDI in device.
|
|
void | Close () |
| Closes the current object by calling the Dispose method.
|
|
void | Dispose () |
| Releases the unmanaged resources used by the MidiIn class and optionally releases the managed resources.
|
|
void | Start () |
| Starts the MIDI input device.
|
|
void | Stop () |
| Stops the MIDI input device.
|
|
void | Reset () |
| Resets the MIDI input device to its default state.
|
|
void | CreateSysexBuffers (int bufferSize, int numberOfBuffers) |
| Creates sysex buffers for MIDI input.
|
|
|
virtual void | Dispose (bool disposing) |
| Closes the MIDI out device.
|
|
|
static int | NumberOfDevices [get] |
| Gets the number of MIDI input devices available in the system.
|
|
|
void | Callback (IntPtr midiInHandle, MidiInterop.MidiInMessage message, IntPtr userData, IntPtr messageParameter1, IntPtr messageParameter2) |
| Callback function for handling MIDI input messages.
|
|
| ~MidiIn () |
| Cleanup.
|
|
Represents a MIDI in device.
◆ MidiIn()
NAudio.Midi.MidiIn.MidiIn |
( |
int | deviceNo | ) |
|
|
inline |
Opens a specified MIDI in device.
- Parameters
-
deviceNo | The device number |
◆ ~MidiIn()
NAudio.Midi.MidiIn.~MidiIn |
( |
| ) |
|
|
inlineprivate |
◆ Callback()
void NAudio.Midi.MidiIn.Callback |
( |
IntPtr | midiInHandle, |
|
|
MidiInterop::MidiInMessage | message, |
|
|
IntPtr | userData, |
|
|
IntPtr | messageParameter1, |
|
|
IntPtr | messageParameter2 ) |
|
inlineprivate |
Callback function for handling MIDI input messages.
- Parameters
-
midiInHandle | Handle to the MIDI input device. |
message | The type of MIDI input message received. |
userData | User-defined data passed to the callback function. |
messageParameter1 | The first parameter associated with the MIDI input message. |
messageParameter2 | The second parameter associated with the MIDI input message. |
This callback function is used to handle different types of MIDI input messages received from the MIDI input device. It switches on the type of message received and performs specific actions based on the message type. If the message type is Data, it raises the MessageReceived event with the packed MIDI message and milliseconds since MidiInStart as parameters. If the message type is Error, it raises the ErrorReceived event with the invalid MIDI message as a parameter. If the message type is LongData, it processes the pointer to MIDI header and milliseconds since MidiInStart to raise the SysexMessageReceived event with the sysex message bytes and milliseconds as parameters.
◆ Close()
void NAudio.Midi.MidiIn.Close |
( |
| ) |
|
|
inline |
Closes the current object by calling the Dispose method.
This method calls the Dispose method to release resources used by the current object.
◆ CreateSysexBuffers()
void NAudio.Midi.MidiIn.CreateSysexBuffers |
( |
int | bufferSize, |
|
|
int | numberOfBuffers ) |
|
inline |
Creates sysex buffers for MIDI input.
- Parameters
-
bufferSize | The size of each buffer. |
numberOfBuffers | The number of buffers to create. |
This method creates sysex buffers for MIDI input. It allocates memory for each buffer, prepares the header, and adds the buffer to the MIDI input device.
- Exceptions
-
MmException | Thrown when there is an error in preparing or adding the buffer to the MIDI input device. |
◆ DeviceInfo()
Retrieves the capabilities of the specified MIDI input device.
- Parameters
-
midiInDeviceNumber | The number of the MIDI input device for which to retrieve the capabilities. |
- Returns
- The capabilities of the specified MIDI input device.
- Exceptions
-
MmException | Thrown when an error occurs while retrieving the device capabilities. |
◆ Dispose() [1/2]
void NAudio.Midi.MidiIn.Dispose |
( |
| ) |
|
|
inline |
Releases the unmanaged resources used by the MidiIn class and optionally releases the managed resources.
- Parameters
-
disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
This method releases the unmanaged resources used by the MidiIn class and optionally releases the managed resources. If disposing is true, this method disposes of all managed and unmanaged resources. If disposing is false, this method releases only the unmanaged resources. If the SysexBufferHeaders array has elements, it resets the MIDI input device, frees up all created and allocated buffers for incoming Sysex messages, and closes the MIDI input device handle.
◆ Dispose() [2/2]
virtual void NAudio.Midi.MidiIn.Dispose |
( |
bool | disposing | ) |
|
|
inlineprotectedvirtual |
Closes the MIDI out device.
- Parameters
-
disposing | True if called from Dispose |
◆ Reset()
void NAudio.Midi.MidiIn.Reset |
( |
| ) |
|
|
inline |
Resets the MIDI input device to its default state.
- Exceptions
-
MmException | Thrown when an error occurs while resetting the MIDI input device. |
◆ Start()
void NAudio.Midi.MidiIn.Start |
( |
| ) |
|
|
inline |
Starts the MIDI input device.
- Exceptions
-
MmException | Thrown when an error occurs while starting the MIDI input device. |
◆ Stop()
void NAudio.Midi.MidiIn.Stop |
( |
| ) |
|
|
inline |
Stops the MIDI input device.
- Exceptions
-
MmException | Thrown when an error occurs while stopping the MIDI input device. |
◆ callback
MidiInterop.MidiInCallback NAudio.Midi.MidiIn.callback |
|
private |
◆ disposed
bool NAudio.Midi.MidiIn.disposed = false |
|
private |
◆ hMidiIn
IntPtr NAudio.Midi.MidiIn.hMidiIn = IntPtr.Zero |
|
private |
◆ SysexBufferHeaders
IntPtr [] NAudio.Midi.MidiIn.SysexBufferHeaders = new IntPtr[0] |
|
private |
◆ NumberOfDevices
int NAudio.Midi.MidiIn.NumberOfDevices |
|
staticget |
Gets the number of MIDI input devices available in the system.
◆ ErrorReceived
◆ MessageReceived
Called when a MIDI message is received.
◆ SysexMessageReceived
Called when a Sysex MIDI message is received.
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.Midi/Midi/MidiIn.cs