Class MidiTimeSpan
Assembly: Melanchall.DryWetMidi.dll
Syntax
public sealed class MidiTimeSpan : ITimeSpan, IComparable, IComparable<MidiTimeSpan>, IEquatable<MidiTimeSpan>
Constructors
MidiTimeSpan()
Declaration
MidiTimeSpan(long)
Initializes a new instance of the
MidiTimeSpan with the specified
time span.
Declaration
public MidiTimeSpan(long timeSpan)
Parameters
Type |
Name |
Description |
long |
timeSpan |
|
Exceptions
Properties
TimeSpan
Declaration
public long TimeSpan { get; }
Property Value
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. |
Exceptions
Clone()
Clones the current time span.
Declaration
Returns
Type |
Description |
ITimeSpan |
Copy of the current time span. |
CompareTo(MidiTimeSpan)
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(MidiTimeSpan other)
Parameters
Type |
Name |
Description |
MidiTimeSpan |
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:
Value | Meaning |
---|
Less than zero | This instance precedes other in the sort order. | Zero | This instance occurs in the same position in the sort order as other . | Greater than zero | This 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:
Value | Meaning |
---|
Less than zero | This instance precedes other in the sort order. | Zero | This instance occurs in the same position in the sort order as other . | Greater than zero | This instance follows other in the sort order. |
|
Divide(MidiTimeSpan)
Divides the current time span by the specified
MidiTimeSpan returning ration
between them.
Declaration
public double Divide(MidiTimeSpan timeSpan)
Parameters
Returns
Exceptions
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
Equals(MidiTimeSpan)
Indicates whether the current object is equal to another object of the same type.
Declaration
public bool Equals(MidiTimeSpan other)
Parameters
Type |
Name |
Description |
MidiTimeSpan |
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
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
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
Parse(string)
Converts the string representation of a MIDI time span to its
MidiTimeSpan
equivalent.
Declaration
public static MidiTimeSpan Parse(string input)
Parameters
Type |
Name |
Description |
string |
input |
A string containing a time span to convert. |
Returns
Exceptions
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. |
Exceptions
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
TryParse(string, out MidiTimeSpan)
Converts the string representation of a MIDI time span to its
MidiTimeSpan
equivalent. A return value indicates whether the conversion succeeded.
Declaration
public static bool TryParse(string input, out MidiTimeSpan timeSpan)
Parameters
Type |
Name |
Description |
string |
input |
A string containing a time span to convert. |
MidiTimeSpan |
timeSpan |
When this method returns, contains the MidiTimeSpan
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 +(MidiTimeSpan, MidiTimeSpan)
Declaration
public static MidiTimeSpan operator +(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
Returns
Type |
Description |
MidiTimeSpan |
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 ==(MidiTimeSpan, MidiTimeSpan)
Declaration
public static bool operator ==(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
Returns
Type |
Description |
bool |
true if time spans are equal, false otherwise. |
explicit operator MidiTimeSpan(long)
Declaration
public static explicit operator MidiTimeSpan(long timeSpan)
Parameters
Returns
Exceptions
operator >(MidiTimeSpan, MidiTimeSpan)
Indicates whether a specified
MidiTimeSpan is greater than another one.
Declaration
public static bool operator >(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
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 >=(MidiTimeSpan, MidiTimeSpan)
Indicates whether a specified
MidiTimeSpan is greater than or equal to
another one.
Declaration
public static bool operator >=(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
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 .
|
implicit operator long(MidiTimeSpan)
Declaration
public static implicit operator long(MidiTimeSpan timeSpan)
Parameters
Returns
Type |
Description |
long |
timeSpan represented as long. |
operator !=(MidiTimeSpan, MidiTimeSpan)
Declaration
public static bool operator !=(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
Returns
Type |
Description |
bool |
false if time spans are equal, true otherwise. |
operator <(MidiTimeSpan, MidiTimeSpan)
Indicates whether a specified
MidiTimeSpan is less than another one.
Declaration
public static bool operator <(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
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 <=(MidiTimeSpan, MidiTimeSpan)
Indicates whether a specified
MidiTimeSpan is less than or equal to
another one.
Declaration
public static bool operator <=(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
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 -(MidiTimeSpan, MidiTimeSpan)
Declaration
public static MidiTimeSpan operator -(MidiTimeSpan timeSpan1, MidiTimeSpan timeSpan2)
Parameters
Returns
Type |
Description |
MidiTimeSpan |
An object whose value is the result of the value of timeSpan1 minus
the value of timeSpan2 . |
Exceptions
Implements
Extension Methods