Class MidiFileUtilities
Inheritance
MidiFileUtilities
Assembly: Melanchall.DryWetMidi.dll
Syntax
public static class MidiFileUtilities
Methods
GetDuration(MidiFile, TimeSpanType)
Gets the duration of the specified
MidiFile. Duration is
defined by the time of last MIDI event of the file.
Declaration
public static ITimeSpan GetDuration(this MidiFile midiFile, TimeSpanType durationType)
Parameters
Type |
Name |
Description |
MidiFile |
midiFile |
MidiFile to get duration of. |
TimeSpanType |
durationType |
The type of time span representing the duration of midiFile . |
Returns
Type |
Description |
ITimeSpan |
An implementation of ITimeSpan representing
duration of midiFile . |
Exceptions
GetDuration(TrackChunk, TimeSpanType, TempoMap)
Gets the duration of the specified
TrackChunk. Duration is
defined by the time of last MIDI event of the track chunk.
Declaration
public static ITimeSpan GetDuration(this TrackChunk trackChunk, TimeSpanType durationType, TempoMap tempoMap)
Parameters
Type |
Name |
Description |
TrackChunk |
trackChunk |
TrackChunk to get duration of. |
TimeSpanType |
durationType |
The type of time span representing the duration of trackChunk . |
TempoMap |
tempoMap |
Tempo map to calculate duration. |
Returns
Type |
Description |
ITimeSpan |
An implementation of ITimeSpan representing
duration of trackChunk . |
Exceptions
GetDuration(IEnumerable<TrackChunk>, TimeSpanType, TempoMap)
Gets the duration of the specified collection of
TrackChunk. Duration is
defined by the time of last MIDI event of the track chunks.
Declaration
public static ITimeSpan GetDuration(this IEnumerable<TrackChunk> trackChunks, TimeSpanType durationType, TempoMap tempoMap)
Parameters
Returns
Type |
Description |
ITimeSpan |
An implementation of ITimeSpan representing
duration of trackChunks . |
Exceptions
GetDuration<TTimeSpan>(MidiFile)
Gets the duration of the specified
MidiFile. Duration is
defined by the time of last MIDI event of the file.
Declaration
public static TTimeSpan GetDuration<TTimeSpan>(this MidiFile midiFile) where TTimeSpan : class, ITimeSpan
Parameters
Returns
Type |
Description |
TTimeSpan |
An instance of TTimeSpan representing
duration of midiFile . |
Type Parameters
Name |
Description |
TTimeSpan |
The type of time span representing the duration of midiFile . |
Exceptions
GetDuration<TTimeSpan>(TrackChunk, TempoMap)
Gets the duration of the specified
TrackChunk. Duration is
defined by the time of last MIDI event of the track chunk.
Declaration
public static TTimeSpan GetDuration<TTimeSpan>(this TrackChunk trackChunk, TempoMap tempoMap) where TTimeSpan : class, ITimeSpan
Parameters
Returns
Type |
Description |
TTimeSpan |
An instance of TTimeSpan representing
duration of trackChunk . |
Type Parameters
Name |
Description |
TTimeSpan |
The type of time span representing the duration of trackChunk . |
Exceptions
GetDuration<TTimeSpan>(IEnumerable<TrackChunk>, TempoMap)
Gets the duration of the specified collection of
TrackChunk. Duration is
defined by the time of last MIDI event of the track chunks.
Declaration
public static TTimeSpan GetDuration<TTimeSpan>(this IEnumerable<TrackChunk> trackChunks, TempoMap tempoMap) where TTimeSpan : class, ITimeSpan
Parameters
Returns
Type |
Description |
TTimeSpan |
An instance of TTimeSpan representing
duration of trackChunks . |
Type Parameters
Name |
Description |
TTimeSpan |
The type of time span representing the duration of trackChunks . |
Exceptions
IsEmpty(MidiFile)
Checks whether the specified
MidiFile is empty or not.
MidiFile
is empty when it doesn't contain MIDI events.
Declaration
public static bool IsEmpty(this MidiFile midiFile)
Parameters
Returns
Type |
Description |
bool |
A value indicating whether midiFile is empty or not. |
Exceptions
ShiftEvents(MidiFile, ITimeSpan)
Shifts events forward inside
MidiFile by the specified distance.
Declaration
public static void ShiftEvents(this MidiFile midiFile, ITimeSpan distance)
Parameters
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
midiFile is null . -
distance is null .
|