Class TimedObjectsManager<TObject>
Provides a way to manage timed objects of the specified type within an EventsCollection
(which can be obtained via Events for example). More info in the
Objects managers article.
Implements
Inherited Members
Namespace: Melanchall.DryWetMidi.Interaction
Assembly: Melanchall.DryWetMidi.dll
Syntax
public class TimedObjectsManager<TObject> : IDisposable where TObject : ITimedObject
Type Parameters
Name | Description |
---|---|
TObject |
Remarks
To start manage objects you need to get an instance of the TimedObjectsManager<TObject>.
Also ManageX
methods within specific object type utilities class (for example,
ManageNotes(TrackChunk, NoteDetectionSettings, TimedEventDetectionSettings, TimedObjectsComparer)
or ManageChords(TrackChunk, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings, TimedObjectsComparer))
can be used.
To finish managing you need to call the SaveChanges() or Dispose() method.
Since the manager implements IDisposable it is recommended to manage objects within
the using
block.
Constructors
TimedObjectsManager(EventsCollection, ObjectDetectionSettings, TimedObjectsComparer)
Initializes a new instance of the TimedObjectsManager<TObject> with the specified
events collection. Optionally object detection settings and comparer can be provided.
Declaration
public TimedObjectsManager(EventsCollection eventsCollection, ObjectDetectionSettings objectDetectionSettings = null, TimedObjectsComparer comparer = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to manage objects within. |
ObjectDetectionSettings | objectDetectionSettings | Settings according to which objects should be detected and built. |
TimedObjectsComparer | comparer | Comparer that will be used to order objects on enumerating
Objects or saving objects back to the eventsCollection
via SaveChanges() or Dispose(). |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | eventsCollection is null . |
Properties
Objects
Gets the TimedObjectsCollection<TObject> with all objects managed by the current
TimedObjectsManager<TObject>.
Declaration
public TimedObjectsCollection<TObject> Objects { get; }
Property Value
Type | Description |
---|---|
TimedObjectsCollection<TObject> |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting
unmanaged resources.
Declaration
public void Dispose()
SaveChanges()
Saves all objects that were managed with the current TimedObjectsManager<TObject>
updating underlying events collection.
Declaration
public void SaveChanges()
Remarks
This method will rewrite content of the events collection was used to construct the current
TimedObjectsManager<TObject> with events were managed by this manager.