Class LengthConverter
Provides a way to convert the length of an object from one representation to another.
More info in the
Time and length article.
Inheritance
LengthConverter
Assembly: Melanchall.DryWetMidi.dll
Syntax
public static class LengthConverter
Methods
ConvertFrom(ITimeSpan, ITimeSpan, TempoMap)
Converts length from the specified length type to
long.
Declaration
public static long ConvertFrom(ITimeSpan length, ITimeSpan time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| ITimeSpan |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
Exceptions
| Type |
Condition |
| ArgumentNullException |
One of the following errors occurred:
-
length is null. -
time is null. -
tempoMap is null.
|
ConvertFrom(ITimeSpan, long, TempoMap)
Converts length from the specified length type to
long.
Declaration
public static long ConvertFrom(ITimeSpan length, long time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| long |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
Exceptions
ConvertTo(ITimeSpan, TimeSpanType, ITimeSpan, TempoMap)
Converts length from one length type to another one.
Declaration
public static ITimeSpan ConvertTo(ITimeSpan length, TimeSpanType lengthType, ITimeSpan time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| TimeSpanType |
lengthType |
Type that will represent the length of an object. |
| ITimeSpan |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| ITimeSpan |
Length as an instance of time span defined by lengthType. |
Exceptions
ConvertTo(ITimeSpan, TimeSpanType, long, TempoMap)
Converts length from one length type to another one.
Declaration
public static ITimeSpan ConvertTo(ITimeSpan length, TimeSpanType lengthType, long time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| TimeSpanType |
lengthType |
Type that will represent the length of an object. |
| long |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| ITimeSpan |
Length as an instance of time span defined by lengthType. |
Exceptions
ConvertTo(ITimeSpan, Type, ITimeSpan, TempoMap)
Converts length from one length type to another one.
Declaration
public static ITimeSpan ConvertTo(ITimeSpan length, Type lengthType, ITimeSpan time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| Type |
lengthType |
Type to convert length to. |
| ITimeSpan |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| ITimeSpan |
Length as an instance of lengthType. |
Exceptions
ConvertTo(ITimeSpan, Type, long, TempoMap)
Converts length from one length type to another one.
Declaration
public static ITimeSpan ConvertTo(ITimeSpan length, Type lengthType, long time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| Type |
lengthType |
Type to convert length to. |
| long |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| ITimeSpan |
Length as an instance of lengthType. |
Exceptions
ConvertTo(long, TimeSpanType, ITimeSpan, TempoMap)
Converts length from
long to the specified length type.
Declaration
public static ITimeSpan ConvertTo(long length, TimeSpanType lengthType, ITimeSpan time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| long |
length |
Length to convert. |
| TimeSpanType |
lengthType |
Type that will represent the length of an object. |
| ITimeSpan |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| ITimeSpan |
Length as an instance of time span defined by lengthType. |
Exceptions
ConvertTo(long, TimeSpanType, long, TempoMap)
Converts length from
long to the specified length type.
Declaration
public static ITimeSpan ConvertTo(long length, TimeSpanType lengthType, long time, TempoMap tempoMap)
Parameters
| Type |
Name |
Description |
| long |
length |
Length to convert. |
| TimeSpanType |
lengthType |
Type that will represent the length of an object. |
| long |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| ITimeSpan |
Length as an instance of time span defined by lengthType. |
Exceptions
ConvertTo<TTimeSpan>(ITimeSpan, ITimeSpan, TempoMap)
Converts length from one length type to another one.
Declaration
public static TTimeSpan ConvertTo<TTimeSpan>(ITimeSpan length, ITimeSpan time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| ITimeSpan |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| TTimeSpan |
Length as an instance of TTimeSpan. |
Type Parameters
| Name |
Description |
| TTimeSpan |
Type that will represent the length of an object. |
Exceptions
ConvertTo<TTimeSpan>(ITimeSpan, long, TempoMap)
Converts length from one length type to another one.
Declaration
public static TTimeSpan ConvertTo<TTimeSpan>(ITimeSpan length, long time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
Parameters
| Type |
Name |
Description |
| ITimeSpan |
length |
Length to convert. |
| long |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| TTimeSpan |
Length as an instance of TTimeSpan. |
Type Parameters
| Name |
Description |
| TTimeSpan |
Type that will represent the length of an object. |
Exceptions
ConvertTo<TTimeSpan>(long, ITimeSpan, TempoMap)
Converts length from
long to the specified length type.
Declaration
public static TTimeSpan ConvertTo<TTimeSpan>(long length, ITimeSpan time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
Parameters
| Type |
Name |
Description |
| long |
length |
Length to convert. |
| ITimeSpan |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| TTimeSpan |
Length as an instance of TTimeSpan. |
Type Parameters
| Name |
Description |
| TTimeSpan |
Type that will represent the length of an object. |
Exceptions
ConvertTo<TTimeSpan>(long, long, TempoMap)
Converts length from
long to the specified length type.
Declaration
public static TTimeSpan ConvertTo<TTimeSpan>(long length, long time, TempoMap tempoMap) where TTimeSpan : ITimeSpan
Parameters
| Type |
Name |
Description |
| long |
length |
Length to convert. |
| long |
time |
Start time of an object to convert length of. |
| TempoMap |
tempoMap |
Tempo map used to convert length. |
Returns
| Type |
Description |
| TTimeSpan |
Length as an instance of TTimeSpan. |
Type Parameters
| Name |
Description |
| TTimeSpan |
Type that will represent the length of an object. |
Exceptions