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