Search Results for

    Show / Hide Table of Contents

    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
    object
    TimeConverter
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Interaction
    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
    Type Description
    long Time as long.
    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
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • time is null.
    • tempoMap is null.
    InvalidEnumArgumentException timeType specified an invalid value.

    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
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • time is null.
    • timeType is null.
    • tempoMap is null.
    NotSupportedException timeType is not supported.

    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
    Type Condition
    ArgumentOutOfRangeException time is negative.
    ArgumentNullException tempoMap is null.
    InvalidEnumArgumentException timeType specified an invalid value.

    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
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • time is null.
    • tempoMap is null.
    NotSupportedException TTimeSpan is not supported.

    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
    Type Condition
    ArgumentOutOfRangeException time is negative.
    ArgumentNullException tempoMap is null.
    NotSupportedException TTimeSpan is not supported.
    In this article
    Back to top 2024 / Generated by DocFX