Class LengthedObjectUtilities
Extension methods for objects that implement the
ILengthedObject interface.
Inheritance
LengthedObjectUtilities
Assembly: Melanchall.DryWetMidi.dll
Syntax
public static class LengthedObjectUtilities
Methods
AtTime<TObject>(IEnumerable<TObject>, ITimeSpan, TempoMap, LengthedObjectPart)
Filters collection of
ILengthedObject to return objects at the specified time.
Declaration
public static IEnumerable<TObject> AtTime<TObject>(this IEnumerable<TObject> objects, ITimeSpan time, TempoMap tempoMap, LengthedObjectPart matchBy) where TObject : ILengthedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
A collection to filter. |
ITimeSpan |
time |
Time to filter objects by. |
TempoMap |
tempoMap |
Tempo map to filter objects by time . |
LengthedObjectPart |
matchBy |
Part of an object which have to be at time . |
Returns
Type |
Description |
IEnumerable<TObject> |
A collection that contains objects from the input sequence that are at the specified time. |
Type Parameters
Name |
Description |
TObject |
The type of the elements of objects . |
Exceptions
AtTime<TObject>(IEnumerable<TObject>, long, LengthedObjectPart)
Filters collection of
ILengthedObject to return objects at the specified time.
Declaration
public static IEnumerable<TObject> AtTime<TObject>(this IEnumerable<TObject> objects, long time, LengthedObjectPart matchBy) where TObject : ILengthedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
A collection to filter. |
long |
time |
Time to filter objects by. |
LengthedObjectPart |
matchBy |
Part of an object which have to be at time . |
Returns
Type |
Description |
IEnumerable<TObject> |
A collection that contains objects from the input sequence that are at the specified time. |
Type Parameters
Name |
Description |
TObject |
The type of the elements of objects . |
Exceptions
EndAtTime<TObject>(IEnumerable<TObject>, ITimeSpan, TempoMap)
Filters collection of
ILengthedObject to return objects that end at the specified time.
Declaration
public static IEnumerable<TObject> EndAtTime<TObject>(this IEnumerable<TObject> objects, ITimeSpan time, TempoMap tempoMap) where TObject : ILengthedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
A collection to filter. |
ITimeSpan |
time |
End time to filter objects by. |
TempoMap |
tempoMap |
Tempo map to filter objects by time . |
Returns
Type |
Description |
IEnumerable<TObject> |
A collection that contains objects from the input sequence that end at the specified time. |
Type Parameters
Name |
Description |
TObject |
The type of the elements of objects . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
objects is null . -
time is null . -
tempoMap is null . - One of the objects is
null .
|
EndAtTime<TObject>(IEnumerable<TObject>, long)
Filters collection of
ILengthedObject to return objects that end at the specified time.
Declaration
public static IEnumerable<TObject> EndAtTime<TObject>(this IEnumerable<TObject> objects, long time) where TObject : ILengthedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
A collection to filter. |
long |
time |
End time to filter objects by. |
Returns
Type |
Description |
IEnumerable<TObject> |
A collection that contains objects from the input sequence that end at the specified time. |
Type Parameters
Name |
Description |
TObject |
The type of the elements of objects . |
Exceptions
EndTimeAs(ILengthedObject, TimeSpanType, TempoMap)
Gets end time of an
ITimedObject as an instance of time span defined by the
specified time span type.
Declaration
public static ITimeSpan EndTimeAs(this ILengthedObject obj, TimeSpanType timeType, TempoMap tempoMap)
Parameters
Type |
Name |
Description |
ILengthedObject |
obj |
Object to get end time of. |
TimeSpanType |
timeType |
The type of time span to convert the end time of obj to. |
TempoMap |
tempoMap |
Tempo map to calculate end time of the obj . |
Returns
Type |
Description |
ITimeSpan |
End time of the specified object as an instance of time span defined by the
timeType . |
Exceptions
EndTimeAs<TTime>(ILengthedObject, TempoMap)
Declaration
public static TTime EndTimeAs<TTime>(this ILengthedObject obj, TempoMap tempoMap) where TTime : ITimeSpan
Parameters
Type |
Name |
Description |
ILengthedObject |
obj |
Object to get end time of. |
TempoMap |
tempoMap |
Tempo map to calculate end time of the obj . |
Returns
Type |
Description |
TTime |
End time of the specified object as an instance of TTime . |
Type Parameters
Name |
Description |
TTime |
Type that will represent the end time of the obj . |
Exceptions
LengthAs(ILengthedObject, TimeSpanType, TempoMap)
Gets length of an
ILengthedObject as an instance of type defined by the
specified time span type.
Declaration
public static ITimeSpan LengthAs(this ILengthedObject obj, TimeSpanType lengthType, TempoMap tempoMap)
Parameters
Type |
Name |
Description |
ILengthedObject |
obj |
Object to get length of. |
TimeSpanType |
lengthType |
The type of time span to convert the length of obj to. |
TempoMap |
tempoMap |
Tempo map to calculate length of the obj . |
Returns
Type |
Description |
ITimeSpan |
Time of the specified object as an instance of time span defined by the
lengthType . |
Exceptions
LengthAs<TLength>(ILengthedObject, TempoMap)
Declaration
public static TLength LengthAs<TLength>(this ILengthedObject obj, TempoMap tempoMap) where TLength : ITimeSpan
Parameters
Type |
Name |
Description |
ILengthedObject |
obj |
Object to get length of. |
TempoMap |
tempoMap |
Tempo map to calculate length of the obj . |
Returns
Type |
Description |
TLength |
Length of the specified object as an instance of TLength . |
Type Parameters
Name |
Description |
TLength |
Type that will represent the length of the obj . |
Exceptions
SetLength<TObject>(TObject, ITimeSpan, TempoMap)
Sets length of the specified object in terms of
ITimeSpan.
Declaration
public static TObject SetLength<TObject>(this TObject obj, ITimeSpan length, TempoMap tempoMap) where TObject : ILengthedObject
Parameters
Type |
Name |
Description |
TObject |
obj |
Object to set length of. |
ITimeSpan |
length |
New length of the obj . |
TempoMap |
tempoMap |
TempoMap used to calculate new length in ticks. |
Returns
Type |
Description |
TObject |
The same object the method was called on. |
Type Parameters
Name |
Description |
TObject |
The type of the obj . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
obj is null . -
length is null . -
tempoMap is null . - One of the objects is
null .
|
StartAtTime<TObject>(IEnumerable<TObject>, ITimeSpan, TempoMap)
Filters collection of
ILengthedObject to return objects that start at the specified time.
Declaration
public static IEnumerable<TObject> StartAtTime<TObject>(this IEnumerable<TObject> objects, ITimeSpan time, TempoMap tempoMap) where TObject : ILengthedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
A collection to filter. |
ITimeSpan |
time |
Start time to filter objects by. |
TempoMap |
tempoMap |
Tempo map to filter objects by time . |
Returns
Type |
Description |
IEnumerable<TObject> |
A collection that contains objects from the input sequence that start at the specified time. |
Type Parameters
Name |
Description |
TObject |
The type of the elements of objects . |
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
-
objects is null . -
time is null . -
tempoMap is null . - One of the objects is
null .
|
StartAtTime<TObject>(IEnumerable<TObject>, long)
Filters collection of
ILengthedObject to return objects that start at the specified time.
Declaration
public static IEnumerable<TObject> StartAtTime<TObject>(this IEnumerable<TObject> objects, long time) where TObject : ILengthedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
A collection to filter. |
long |
time |
Start time to filter objects by. |
Returns
Type |
Description |
IEnumerable<TObject> |
A collection that contains objects from the input sequence that start at the specified time. |
Type Parameters
Name |
Description |
TObject |
The type of the elements of objects . |
Exceptions