Interface ILengthedObject
Represents an object that has length.
Namespace: Melanchall.DryWetMidi.Interaction
Assembly: Melanchall.DryWetMidi.dll
Syntax
public interface ILengthedObject : ITimedObject
Properties
EndTime
Gets the end time of an object.
Declaration
long EndTime { get; }
Property Value
Type | Description |
---|---|
long |
Length
Gets the length of an object.
Declaration
long Length { get; set; }
Property Value
Type | Description |
---|---|
long |
Remarks
Note that the returned value will be in ticks (not seconds, not milliseconds and so on).
Please read Time and length article to learn how you can
get the length in different representations.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | value is negative. |
Methods
Split(long)
Splits the current object by the specified time.
Declaration
SplitLengthedObject Split(long time)
Parameters
Type | Name | Description |
---|---|---|
long | time | Time to split the object at. |
Returns
Type | Description |
---|---|
SplitLengthedObject | An object containing left and right parts of the split object. Both parts have the same type as the original object. |
Remarks
If time
is less than or equal to time of the object, the left part will
be null
. If time
is greater than or equal to end time of the object,
the right part will be null
.
Let's see a simple example. Suppose we have an object with time of 10
and length of 50
.
The table below shows what left and right parts will be in case of different values of
time
:
Time to split at | Left part | Right part |
---|---|---|
5
|
null
| Copy of the object |
10
|
null
| Copy of the object |
30
| Copy of the object with time of 10 and length of 20 | Copy of the object with time of 30 and length of 30 |
60
| Copy of the object |
null
|
70
| Copy of the object |
null
|
To learn about other ways to split an object please read Objects splitting article.
Exceptions
Type | Condition |
---|---|
ArgumentOutOfRangeException | time is negative. |