Class able to read a MIDI file.
More...
|
| MidiFile (string filename) |
| Opens a MIDI file for reading.
|
|
| MidiFile (string filename, bool strictChecking) |
| Opens a MIDI file for reading.
|
|
| MidiFile (Stream inputStream, bool strictChecking) |
| Opens a MIDI file stream for reading.
|
|
override string | ToString () |
| Returns a string representation of the MIDI file.
|
|
|
| MidiFile (Stream inputStream, bool strictChecking, bool ownInputStream) |
|
void | FindNoteOn (NoteEvent offEvent, List< NoteOnEvent > outstandingNoteOns) |
| Finds and updates the corresponding NoteOnEvent in the list of outstandingNoteOns with the provided NoteOffEvent.
|
|
|
static uint | SwapUInt32 (uint i) |
| Swaps the bytes of a 32-bit unsigned integer and returns the result.
|
|
static ushort | SwapUInt16 (ushort i) |
| Swaps the high and low bytes of the input unsigned 16-bit integer and returns the result.
|
|
Class able to read a MIDI file.
◆ MidiFile() [1/4]
NAudio.Midi.MidiFile.MidiFile |
( |
string | filename | ) |
|
|
inline |
Opens a MIDI file for reading.
- Parameters
-
filename | Name of MIDI file |
◆ MidiFile() [2/4]
NAudio.Midi.MidiFile.MidiFile |
( |
string | filename, |
|
|
bool | strictChecking ) |
|
inline |
Opens a MIDI file for reading.
- Parameters
-
filename | Name of MIDI file |
strictChecking | If true will error on non-paired note events |
◆ MidiFile() [3/4]
NAudio.Midi.MidiFile.MidiFile |
( |
Stream | inputStream, |
|
|
bool | strictChecking ) |
|
inline |
Opens a MIDI file stream for reading.
- Parameters
-
inputStream | The input stream containing a MIDI file |
strictChecking | If true will error on non-paired note events |
◆ MidiFile() [4/4]
NAudio.Midi.MidiFile.MidiFile |
( |
Stream | inputStream, |
|
|
bool | strictChecking, |
|
|
bool | ownInputStream ) |
|
inlineprivate |
◆ Export()
Exports the MIDI events to a file with the specified filename.
- Parameters
-
filename | The name of the file to which the MIDI events will be exported. |
events | The collection of MIDI events to be exported. |
- Exceptions
-
ArgumentException | Thrown when attempting to export more than one track to a type 0 file. |
This method exports the MIDI events to a file with the specified filename. If the MIDI file type is 0 and there are more than one track, an ArgumentException is thrown. The method writes the MIDI events to the file in the specified format, including the header and track information.
◆ FindNoteOn()
Finds and updates the corresponding NoteOnEvent in the list of outstandingNoteOns with the provided NoteOffEvent.
- Parameters
-
offEvent | The NoteOffEvent to find a corresponding NoteOnEvent for. |
outstandingNoteOns | The list of outstanding NoteOnEvents to search for a matching NoteOnEvent. |
- Exceptions
-
FormatException | Thrown when a NoteOffEvent is received without a corresponding NoteOnEvent, and strictChecking is enabled. |
This method iterates through the list of outstandingNoteOns to find a matching NoteOnEvent based on the channel and note number. If a matching NoteOnEvent is found, it updates the OffEvent property of the NoteOnEvent with the provided offEvent, removes the NoteOnEvent from the list of outstandingNoteOns, and sets the found flag to true. If no matching NoteOnEvent is found and strictChecking is enabled, it throws a FormatException with a message indicating that an off without an on was received.
◆ SwapUInt16()
static ushort NAudio.Midi.MidiFile.SwapUInt16 |
( |
ushort | i | ) |
|
|
inlinestaticprivate |
Swaps the high and low bytes of the input unsigned 16-bit integer and returns the result.
- Parameters
-
i | The unsigned 16-bit integer to be swapped. |
- Returns
- The result of swapping the high and low bytes of the input i .
This method takes an unsigned 16-bit integer i and swaps its high and low bytes. It does this by first masking the high and low bytes using bitwise AND operations, shifting the high byte to the low byte position, and shifting the low byte to the high byte position using bitwise OR operations. The result is then returned as the swapped unsigned 16-bit integer.
◆ SwapUInt32()
static uint NAudio.Midi.MidiFile.SwapUInt32 |
( |
uint | i | ) |
|
|
inlinestaticprivate |
Swaps the bytes of a 32-bit unsigned integer and returns the result.
- Parameters
-
i | The 32-bit unsigned integer to swap the bytes of. |
- Returns
- The 32-bit unsigned integer with its bytes swapped.
This method swaps the bytes of the input 32-bit unsigned integer i such that the most significant byte becomes the least significant byte and vice versa.
◆ ToString()
override string NAudio.Midi.MidiFile.ToString |
( |
| ) |
|
|
inline |
Returns a string representation of the MIDI file.
- Returns
- A string containing the format, number of tracks, and delta ticks per quarter note, followed by a list of MIDI events for each track.
◆ deltaTicksPerQuarterNote
readonly ushort NAudio.Midi.MidiFile.deltaTicksPerQuarterNote |
|
private |
◆ events
◆ fileFormat
readonly ushort NAudio.Midi.MidiFile.fileFormat |
|
private |
◆ strictChecking
readonly bool NAudio.Midi.MidiFile.strictChecking |
|
private |
◆ DeltaTicksPerQuarterNote
int NAudio.Midi.MidiFile.DeltaTicksPerQuarterNote |
|
get |
Delta Ticks Per Quarter Note.
◆ Events
The collection of events in this MIDI file.
◆ FileFormat
int NAudio.Midi.MidiFile.FileFormat |
|
get |
◆ Tracks
int NAudio.Midi.MidiFile.Tracks |
|
get |
Number of tracks in this MIDI file.
The documentation for this class was generated from the following file:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/LiveMicrophone/lib/NAudio.Midi/Midi/MidiFile.cs