Search Results for

    Show / Hide Table of Contents

    Class BarBeatTicksTimeSpan

    Represents bar/beat time span which represents bars, beats and ticks. More info in the Time and length: Representations: Bars, beats and ticks article.
    Inheritance
    object
    BarBeatTicksTimeSpan
    Implements
    ITimeSpan
    IComparable
    IComparable<BarBeatTicksTimeSpan>
    IEquatable<BarBeatTicksTimeSpan>
    Inherited Members
    object.Equals(object, object)
    object.GetType()
    object.ReferenceEquals(object, object)
    Namespace: Melanchall.DryWetMidi.Interaction
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class BarBeatTicksTimeSpan : ITimeSpan, IComparable, IComparable<BarBeatTicksTimeSpan>, IEquatable<BarBeatTicksTimeSpan>

    Constructors

    BarBeatTicksTimeSpan()

    Initializes a new instance of the BarBeatTicksTimeSpan.
    Declaration
    public BarBeatTicksTimeSpan()

    BarBeatTicksTimeSpan(long)

    Initializes a new instance of the BarBeatTicksTimeSpan with the specified number of bars.
    Declaration
    public BarBeatTicksTimeSpan(long bars)
    Parameters
    Type Name Description
    long bars The number of bars.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException bars is negative.

    BarBeatTicksTimeSpan(long, long)

    Initializes a new instance of the BarBeatTicksTimeSpan with the specified number of bars and beats.
    Declaration
    public BarBeatTicksTimeSpan(long bars, long beats)
    Parameters
    Type Name Description
    long bars The number of bars.
    long beats The number of beats.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • bars is negative.
    • beats is negative.

    BarBeatTicksTimeSpan(long, long, long)

    Initializes a new instance of the BarBeatTicksTimeSpan with the specified number of bars, beats and ticks.
    Declaration
    public BarBeatTicksTimeSpan(long bars, long beats, long ticks)
    Parameters
    Type Name Description
    long bars The number of bars.
    long beats The number of beats.
    long ticks The number of ticks.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • bars is negative.
    • beats is negative.
    • ticks is negative.

    Properties

    Bars

    Gets the bars component of the time represented by the current BarBeatTicksTimeSpan.
    Declaration
    public long Bars { get; }
    Property Value
    Type Description
    long

    Beats

    Gets the beats component of the time represented by the current BarBeatTicksTimeSpan.
    Declaration
    public long Beats { get; }
    Property Value
    Type Description
    long

    Ticks

    Gets the ticks component of the time represented by the current BarBeatTicksTimeSpan.
    Declaration
    public long Ticks { get; }
    Property Value
    Type Description
    long

    Methods

    Add(ITimeSpan, TimeSpanMode)

    Adds a time span to the current one.
    Declaration
    public ITimeSpan Add(ITimeSpan timeSpan, TimeSpanMode mode)
    Parameters
    Type Name Description
    ITimeSpan timeSpan Time span to add to the current one.
    TimeSpanMode mode Mode of the operation that defines meaning of time spans the operation will be performed on.
    Returns
    Type Description
    ITimeSpan Time span that is a sum of the timeSpan and the current time span.
    Remarks
    If timeSpan and the current time span have the same type, the result time span will be of this type too; otherwise - of the MathTimeSpan.
    Exceptions
    Type Condition
    ArgumentNullException timeSpan is invalid.
    InvalidEnumArgumentException mode specified an invalid value.

    Clone()

    Clones the current time span.
    Declaration
    public ITimeSpan Clone()
    Returns
    Type Description
    ITimeSpan Copy of the current time span.

    CompareTo(BarBeatTicksTimeSpan)

    Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
    Declaration
    public int CompareTo(BarBeatTicksTimeSpan other)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan other An object to compare with this instance.
    Returns
    Type Description
    int

    A value that indicates the relative order of the objects being compared. The return value has these meanings:

    ValueMeaning
    Less than zeroThis instance precedes other in the sort order.
    ZeroThis instance occurs in the same position in the sort order as other.
    Greater than zeroThis instance follows other in the sort order.

    CompareTo(object)

    Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
    Declaration
    public int CompareTo(object other)
    Parameters
    Type Name Description
    object other An object to compare with this instance.
    Returns
    Type Description
    int

    A value that indicates the relative order of the objects being compared. The return value has these meanings:

    ValueMeaning
    Less than zeroThis instance precedes other in the sort order.
    ZeroThis instance occurs in the same position in the sort order as other.
    Greater than zeroThis instance follows other in the sort order.

    Divide(double)

    Shrinks the current time span by dividing its length by the specified divisor.
    Declaration
    public ITimeSpan Divide(double divisor)
    Parameters
    Type Name Description
    double divisor Divisor to shrink the time span by.
    Returns
    Type Description
    ITimeSpan Time span that is the current time span shrinked by the divisor.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException divisor is zero or negative.

    Equals(BarBeatTicksTimeSpan)

    Indicates whether the current object is equal to another object of the same type.
    Declaration
    public bool Equals(BarBeatTicksTimeSpan other)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan other An object to compare with this object.
    Returns
    Type Description
    bool true if the current object is equal to the other parameter; otherwise, false.

    Equals(object)

    Determines whether the specified object is equal to the current object.
    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    object obj The object to compare with the current object.
    Returns
    Type Description
    bool true if the specified object is equal to the current object; otherwise, false.
    Overrides
    object.Equals(object)

    GetHashCode()

    Returns the hash code for this instance.
    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    int A 32-bit signed integer hash code.
    Overrides
    object.GetHashCode()

    Multiply(double)

    Stretches the current time span by multiplying its length by the specified multiplier.
    Declaration
    public ITimeSpan Multiply(double multiplier)
    Parameters
    Type Name Description
    double multiplier Multiplier to stretch the time span by.
    Returns
    Type Description
    ITimeSpan Time span that is the current time span stretched by the multiplier.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException multiplier is negative.

    Parse(string)

    Converts the string representation of a bar/beat time span to its BarBeatTicksTimeSpan equivalent.
    Declaration
    public static BarBeatTicksTimeSpan Parse(string input)
    Parameters
    Type Name Description
    string input A string containing a time span to convert.
    Returns
    Type Description
    BarBeatTicksTimeSpan A BarBeatTicksTimeSpan equivalent to the time span contained in input.
    Exceptions
    Type Condition
    ArgumentException input is null or contains white-spaces only.
    FormatException input has invalid format.

    Subtract(ITimeSpan, TimeSpanMode)

    Subtracts a time span from the current one.
    Declaration
    public ITimeSpan Subtract(ITimeSpan timeSpan, TimeSpanMode mode)
    Parameters
    Type Name Description
    ITimeSpan timeSpan Time span to subtract from the current one.
    TimeSpanMode mode Mode of the operation that defines meaning of time spans the operation will be performed on.
    Returns
    Type Description
    ITimeSpan Time span that is a difference between the timeSpan and the current time span.
    Remarks
    If timeSpan and the current time span have the same type, the result time span will be of this type too; otherwise - of the MathTimeSpan.
    Exceptions
    Type Condition
    ArgumentNullException timeSpan is invalid.
    InvalidEnumArgumentException mode specified an invalid value.

    ToString()

    Returns a string that represents the current object.
    Declaration
    public override string ToString()
    Returns
    Type Description
    string A string that represents the current object.
    Overrides
    object.ToString()

    TryParse(string, out BarBeatTicksTimeSpan)

    Converts the string representation of a bar/beat time span to its BarBeatTicksTimeSpan equivalent. A return value indicates whether the conversion succeeded.
    Declaration
    public static bool TryParse(string input, out BarBeatTicksTimeSpan timeSpan)
    Parameters
    Type Name Description
    string input A string containing a time span to convert.
    BarBeatTicksTimeSpan timeSpan When this method returns, contains the BarBeatTicksTimeSpan equivalent of the time span contained in input, if the conversion succeeded, or null if the conversion failed. The conversion fails if the input is null or Empty, or is not of the correct format. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
    Returns
    Type Description
    bool true if input was converted successfully; otherwise, false.

    Operators

    operator +(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Adds two specified BarBeatTicksTimeSpan instances.
    Declaration
    public static BarBeatTicksTimeSpan operator +(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The first BarBeatTicksTimeSpan to add.
    BarBeatTicksTimeSpan timeSpan2 The second BarBeatTicksTimeSpan to add.
    Returns
    Type Description
    BarBeatTicksTimeSpan An object whose value is the sum of the values of timeSpan1 and timeSpan2.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • timeSpan1 is null.
    • timeSpan2 is null.

    operator ==(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Determines if two BarBeatTicksTimeSpan objects are equal.
    Declaration
    public static bool operator ==(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The first BarBeatTicksTimeSpan to compare.
    BarBeatTicksTimeSpan timeSpan2 The second BarBeatTicksTimeSpan to compare.
    Returns
    Type Description
    bool true if time spans are equal, false otherwise.

    operator >(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Indicates whether a specified BarBeatTicksTimeSpan is greater than another one.
    Declaration
    public static bool operator >(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The first BarBeatTicksTimeSpan to compare.
    BarBeatTicksTimeSpan timeSpan2 The second BarBeatTicksTimeSpan to compare.
    Returns
    Type Description
    bool true if the value of timeSpan1 is greater than the value of timeSpan2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • timeSpan1 is null.
    • timeSpan2 is null.

    operator >=(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Indicates whether a specified BarBeatTicksTimeSpan is greater than or equal to another one.
    Declaration
    public static bool operator >=(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The first BarBeatTicksTimeSpan to compare.
    BarBeatTicksTimeSpan timeSpan2 The second BarBeatTicksTimeSpan to compare.
    Returns
    Type Description
    bool true if the value of timeSpan1 is greater than or equal to the value of timeSpan2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • timeSpan1 is null.
    • timeSpan2 is null.

    operator !=(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Determines if two BarBeatTicksTimeSpan objects are not equal.
    Declaration
    public static bool operator !=(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The first BarBeatTicksTimeSpan to compare.
    BarBeatTicksTimeSpan timeSpan2 The second BarBeatTicksTimeSpan to compare.
    Returns
    Type Description
    bool false if time spans are equal, true otherwise.

    operator <(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Indicates whether a specified BarBeatTicksTimeSpan is less than another one.
    Declaration
    public static bool operator <(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The first BarBeatTicksTimeSpan to compare.
    BarBeatTicksTimeSpan timeSpan2 The second BarBeatTicksTimeSpan to compare.
    Returns
    Type Description
    bool true if the value of timeSpan1 is less than the value of timeSpan2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • timeSpan1 is null.
    • timeSpan2 is null.

    operator <=(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Indicates whether a specified BarBeatTicksTimeSpan is less than or equal to another one.
    Declaration
    public static bool operator <=(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The first BarBeatTicksTimeSpan to compare.
    BarBeatTicksTimeSpan timeSpan2 The second BarBeatTicksTimeSpan to compare.
    Returns
    Type Description
    bool true if the value of timeSpan1 is less than or equal to the value of timeSpan2; otherwise, false.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • timeSpan1 is null.
    • timeSpan2 is null.

    operator -(BarBeatTicksTimeSpan, BarBeatTicksTimeSpan)

    Subtracts a specified BarBeatTicksTimeSpan from another one.
    Declaration
    public static BarBeatTicksTimeSpan operator -(BarBeatTicksTimeSpan timeSpan1, BarBeatTicksTimeSpan timeSpan2)
    Parameters
    Type Name Description
    BarBeatTicksTimeSpan timeSpan1 The minuend.
    BarBeatTicksTimeSpan timeSpan2 The subtrahend.
    Returns
    Type Description
    BarBeatTicksTimeSpan An object whose value is the result of the value of timeSpan1 minus the value of timeSpan2.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • timeSpan1 is null.
    • timeSpan2 is null.
    ArgumentException timeSpan1 is less than timeSpan2.

    Implements

    ITimeSpan
    IComparable
    IComparable<T>
    IEquatable<T>

    Extension Methods

    TimeSpanUtilities.IsZeroTimeSpan(ITimeSpan)
    TimeSpanUtilities.Round(ITimeSpan, TimeSpanRoundingPolicy, long, ITimeSpan, TempoMap)
    In this article
    Back to top 2024 / Generated by DocFX