Class TimedObjectUtilities
Extension methods for objects that implement the
ITimedObject interface.
Inheritance
TimedObjectUtilities
Assembly: Melanchall.DryWetMidi.dll
Syntax
public static class TimedObjectUtilities
Methods
AddObjects(EventsCollection, IEnumerable<ITimedObject>)
Declaration
public static void AddObjects(this EventsCollection eventsCollection, IEnumerable<ITimedObject> timedObjects)
Parameters
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
eventsCollection is null .timedObjects is null .
|
AddObjects(TrackChunk, IEnumerable<ITimedObject>)
Adds the specified collection of objects to
TrackChunk.
Declaration
public static void AddObjects(this TrackChunk trackChunk, IEnumerable<ITimedObject> timedObjects)
Parameters
Exceptions
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
trackChunk is null .timedObjects is null .
|
AtTime<TObject>(IEnumerable<TObject>, ITimeSpan, TempoMap)
Filters collection of
ITimedObject to return objects at the specified time.
Declaration
public static IEnumerable<TObject> AtTime<TObject>(this IEnumerable<TObject> objects, ITimeSpan time, TempoMap tempoMap)
where TObject : ITimedObject
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 . |
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
Type |
Condition |
ArgumentNullException |
One of the following errors occurred:
objects is null .time is null .tempoMap is null .
|
AtTime<TObject>(IEnumerable<TObject>, Int64)
Filters collection of
ITimedObject to return objects at the specified time.
Declaration
public static IEnumerable<TObject> AtTime<TObject>(this IEnumerable<TObject> objects, long time)
where TObject : ITimedObject
Parameters
Type |
Name |
Description |
IEnumerable<TObject> |
objects |
A collection to filter. |
Int64 |
time |
Time to filter objects by. |
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
SetTime<TObject>(TObject, ITimeSpan, TempoMap)
Sets time of the specified object in terms of
ITimeSpan.
Declaration
public static TObject SetTime<TObject>(this TObject obj, ITimeSpan time, TempoMap tempoMap)
where TObject : ITimedObject
Parameters
Type |
Name |
Description |
TObject |
obj |
Object to set time of. |
ITimeSpan |
time |
New time of the obj . |
TempoMap |
tempoMap |
TempoMap used to calculate new time 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 .time is null .tempoMap is null .- One of the objects is
null .
|
TimeAs(ITimedObject, TimeSpanType, TempoMap)
Gets time of an
ITimedObject as an instance of time span defined by the
specified time span type.
Declaration
public static ITimeSpan TimeAs(this ITimedObject obj, TimeSpanType timeType, TempoMap tempoMap)
Parameters
Type |
Name |
Description |
ITimedObject |
obj |
Object to get time of. |
TimeSpanType |
timeType |
The type of time span to convert the time of obj to. |
TempoMap |
tempoMap |
Tempo map to calculate time of the obj . |
Returns
Type |
Description |
ITimeSpan |
Time of the specified object as an instance of time span defined by the
timeType . |
Exceptions
TimeAs<TTime>(ITimedObject, TempoMap)
Declaration
public static TTime TimeAs<TTime>(this ITimedObject obj, TempoMap tempoMap)
where TTime : ITimeSpan
Parameters
Type |
Name |
Description |
ITimedObject |
obj |
Object to get time of. |
TempoMap |
tempoMap |
Tempo map to calculate time of the obj . |
Returns
Type |
Description |
TTime |
Time of the specified object as an instance of TTime . |
Type Parameters
Name |
Description |
TTime |
Type that will represent the time of the obj . |
Exceptions
ToFile(IEnumerable<ITimedObject>)
Creates a MIDI file with the specified timed objects.
Declaration
public static MidiFile ToFile(this IEnumerable<ITimedObject> timedObjects)
Parameters
Returns
Exceptions
ToTrackChunk(IEnumerable<ITimedObject>)
Creates a track chunk with the specified objects.
Declaration
public static TrackChunk ToTrackChunk(this IEnumerable<ITimedObject> timedObjects)
Parameters
Returns
Exceptions