Class TimedEventsManagingUtilities
Extension methods for managing MIDI events by their absolute time.
Inherited Members
Namespace: Melanchall.DryWetMidi.Interaction
Assembly: Melanchall.DryWetMidi.dll
Syntax
public static class TimedEventsManagingUtilities
Methods
GetTimedEvents(EventsCollection, TimedEventDetectionSettings)
Gets timed events contained in the specified EventsCollection. More info in the
Getting objects: GetTimedEvents article.
Declaration
public static ICollection<TimedEvent> GetTimedEvents(this EventsCollection eventsCollection, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for events. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<TimedEvent> | Collection of timed events contained in eventsCollection ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | eventsCollection is null . |
See Also
GetTimedEvents(MidiFile, TimedEventDetectionSettings)
Gets timed events contained in the specified MidiFile. More info in the
Getting objects: GetTimedEvents article.
Declaration
public static ICollection<TimedEvent> GetTimedEvents(this MidiFile file, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for events. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<TimedEvent> | Collection of timed events contained in file ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | file is null . |
See Also
GetTimedEvents(TrackChunk, TimedEventDetectionSettings)
Gets timed events contained in the specified TrackChunk. More info in the
Getting objects: GetTimedEvents article.
Declaration
public static ICollection<TimedEvent> GetTimedEvents(this TrackChunk trackChunk, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for events. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<TimedEvent> | Collection of timed events contained in trackChunk ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunk is null . |
See Also
GetTimedEvents(IEnumerable<TrackChunk>, TimedEventDetectionSettings)
Gets timed events contained in the specified collection of TrackChunk. More info in the
Getting objects: GetTimedEvents article.
Declaration
public static ICollection<TimedEvent> GetTimedEvents(this IEnumerable<TrackChunk> trackChunks, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Track chunks to search for events. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
ICollection<TimedEvent> | Collection of timed events contained in trackChunks ordered by time. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunks is null . |
See Also
ManageTimedEvents(EventsCollection, TimedEventDetectionSettings, TimedObjectsComparer)
Creates an instance of the TimedObjectsManager<TObject> initializing it with the
specified events collection. More info in the Objects managers article.
Declaration
public static TimedObjectsManager<TimedEvent> ManageTimedEvents(this EventsCollection eventsCollection, TimedEventDetectionSettings settings = null, TimedObjectsComparer comparer = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection that holds events to manage. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedObjectsComparer | comparer | Comparer that will be used to order objects on enumerating and saving objects
back to the eventsCollection via SaveChanges()
or Dispose(). |
Returns
Type | Description |
---|---|
TimedObjectsManager<TimedEvent> | An instance of the TimedObjectsManager<TObject> that can be used to manage
events represented by the eventsCollection . |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | eventsCollection is null . |
ManageTimedEvents(TrackChunk, TimedEventDetectionSettings, TimedObjectsComparer)
Creates an instance of the TimedObjectsManager<TObject> initializing it with the
events collection of the specified track chunk. More info in the
Objects managers article.
Declaration
public static TimedObjectsManager<TimedEvent> ManageTimedEvents(this TrackChunk trackChunk, TimedEventDetectionSettings settings = null, TimedObjectsComparer comparer = null)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk that holds events to manage. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedObjectsComparer | comparer | Comparer that will be used to order objects on enumerating and saving objects
back to the trackChunk via SaveChanges()
or Dispose(). |
Returns
Type | Description |
---|---|
TimedObjectsManager<TimedEvent> | An instance of the TimedObjectsManager<TObject> that can be used to manage
events represented by the trackChunk . |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunk is null . |
ProcessTimedEvents(EventsCollection, Action<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the EventsCollection.
More info in the Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this EventsCollection eventsCollection, Action<TimedEvent> action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
eventsCollection . |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
ProcessTimedEvents(EventsCollection, Action<TimedEvent>, Predicate<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the EventsCollection.
More info in the Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this EventsCollection eventsCollection, Action<TimedEvent> action, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
eventsCollection . |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to process. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
ProcessTimedEvents(MidiFile, Action<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the MidiFile.
More info in the Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this MidiFile file, Action<TimedEvent> action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
file . |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
ProcessTimedEvents(MidiFile, Action<TimedEvent>, Predicate<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the MidiFile.
More info in the Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this MidiFile file, Action<TimedEvent> action, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
file . |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to process. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
ProcessTimedEvents(TrackChunk, Action<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the TrackChunk.
More info in the Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this TrackChunk trackChunk, Action<TimedEvent> action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
trackChunk . |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
ProcessTimedEvents(TrackChunk, Action<TimedEvent>, Predicate<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the TrackChunk.
More info in the Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this TrackChunk trackChunk, Action<TimedEvent> action, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
trackChunk . |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to process. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
ProcessTimedEvents(IEnumerable<TrackChunk>, Action<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the collection of
TrackChunk. More info in the
Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this IEnumerable<TrackChunk> trackChunks, Action<TimedEvent> action, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
trackChunks . |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
ProcessTimedEvents(IEnumerable<TrackChunk>, Action<TimedEvent>, Predicate<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
Performs the specified action on each TimedEvent contained in the collection of
TrackChunk. More info in the
Processing objects: ProcessTimedEvents article.
Declaration
public static int ProcessTimedEvents(this IEnumerable<TrackChunk> trackChunks, Action<TimedEvent> action, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null, TimedEventProcessingHint hint = TimedEventProcessingHint.Default)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for events to process. |
Action<TimedEvent> | action | The action to perform on each TimedEvent contained in the
trackChunks . |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to process. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
TimedEventProcessingHint | hint | Hint which tells the processing algorithm how it can optimize its performance. The default value is Default. |
Returns
Type | Description |
---|---|
int | Count of processed timed events. |
Remarks
Note that you can always use an object manager to
perform any manipulations with timed events but dedicated methods of the TimedEventsManagingUtilities will
always be faster and will consume less memory.
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
RemoveTimedEvents(EventsCollection)
Removes all timed events from the EventsCollection.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this EventsCollection eventsCollection)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for events to remove. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | eventsCollection is null . |
See Also
RemoveTimedEvents(EventsCollection, Predicate<TimedEvent>, TimedEventDetectionSettings)
Removes timed events that match the specified conditions from the EventsCollection.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this EventsCollection eventsCollection, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
EventsCollection | eventsCollection | EventsCollection to search for events to remove. |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to remove. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
RemoveTimedEvents(MidiFile)
Removes all timed events from the MidiFile.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this MidiFile file)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for events to remove. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | file is null . |
See Also
RemoveTimedEvents(MidiFile, Predicate<TimedEvent>, TimedEventDetectionSettings)
Removes timed events that match the specified conditions from the MidiFile.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this MidiFile file, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
MidiFile | file | MidiFile to search for events to remove. |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to remove. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
RemoveTimedEvents(TrackChunk)
Removes all timed events from the TrackChunk.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this TrackChunk trackChunk)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for events to remove. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunk is null . |
See Also
RemoveTimedEvents(TrackChunk, Predicate<TimedEvent>, TimedEventDetectionSettings)
Removes timed events that match the specified conditions from the TrackChunk.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this TrackChunk trackChunk, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
TrackChunk | trackChunk | TrackChunk to search for events to remove. |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to remove. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|
See Also
RemoveTimedEvents(IEnumerable<TrackChunk>)
Removes all timed events from the collection of TrackChunk.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this IEnumerable<TrackChunk> trackChunks)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for events to remove. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | trackChunks is null . |
See Also
RemoveTimedEvents(IEnumerable<TrackChunk>, Predicate<TimedEvent>, TimedEventDetectionSettings)
Removes timed events that match the specified conditions from the collection of TrackChunk.
More info in the Removing objects: RemoveTimedEvents article.
Declaration
public static int RemoveTimedEvents(this IEnumerable<TrackChunk> trackChunks, Predicate<TimedEvent> match, TimedEventDetectionSettings settings = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<TrackChunk> | trackChunks | Collection of TrackChunk to search for events to remove. |
Predicate<TimedEvent> | match | The predicate that defines the conditions of the TimedEvent to remove. |
TimedEventDetectionSettings | settings | Settings according to which timed events should be detected and built. |
Returns
Type | Description |
---|---|
int | Count of removed timed events. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException | One of the following errors occurred:
|