Search Results for

    Show / Hide Table of Contents

    Class EventsCollection

    Collection of MidiEvent objects.
    Inheritance
    object
    EventsCollection
    Implements
    ICollection<MidiEvent>
    IEnumerable<MidiEvent>
    IEnumerable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Core
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class EventsCollection : ICollection<MidiEvent>, IEnumerable<MidiEvent>, IEnumerable

    Properties

    Count

    Gets the number of events contained in the collection.
    Declaration
    public int Count { get; }
    Property Value
    Type Description
    int

    IsReadOnly

    Gets a value indicating whether the EventsCollection is read-only.
    Declaration
    public bool IsReadOnly { get; }
    Property Value
    Type Description
    bool

    this[int]

    Gets or sets the event at the specified index.
    Declaration
    public MidiEvent this[int index] { get; set; }
    Parameters
    Type Name Description
    int index The zero-based index of the event to get or set.
    Property Value
    Type Description
    MidiEvent The event at the specified index.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException index is less than 0; or index is equal to or greater than Count.
    ArgumentNullException value is null.

    Methods

    Add(MidiEvent)

    Adds an event to the end of collection.
    Declaration
    public void Add(MidiEvent midiEvent)
    Parameters
    Type Name Description
    MidiEvent midiEvent The event to be added to the end of the collection.
    Remarks
    Note that End Of Track events cannot be added into the collection since it may cause inconsistency in a track chunk structure. End Of Track event will be written to the track chunk automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException midiEvent is null.

    AddRange(IEnumerable<MidiEvent>)

    Adds events to the end of collection.
    Declaration
    public void AddRange(IEnumerable<MidiEvent> events)
    Parameters
    Type Name Description
    IEnumerable<MidiEvent> events Events to be added to the end of the collection.
    Remarks
    Note that End Of Track events cannot be added into the collection since it may cause inconsistency in a track chunk structure. End Of Track event will be written to the track chunk automatically on Write(string, bool, MidiFileFormat, WritingSettings).
    Exceptions
    Type Condition
    ArgumentNullException events is null.

    Clear()

    Removes all events from the EventsCollection.
    Declaration
    public void Clear()

    Contains(MidiEvent)

    Determines whether the EventsCollection contains a specific event.
    Declaration
    public bool Contains(MidiEvent item)
    Parameters
    Type Name Description
    MidiEvent item The event to locate in the EventsCollection.
    Returns
    Type Description
    bool true if event is found in the EventsCollection; otherwise, false.

    CopyTo(MidiEvent[], int)

    Copies the elements of the EventsCollection to an Array, starting at a particular index.
    Declaration
    public void CopyTo(MidiEvent[] array, int arrayIndex)
    Parameters
    Type Name Description
    MidiEvent[] array The one-dimensional Array that is the destination of the elements copied from EventsCollection. The array must have zero-based indexing.
    int arrayIndex The zero-based index in array at which copying begins.
    Exceptions
    Type Condition
    ArgumentNullException array is null.
    ArgumentOutOfRangeException arrayIndex is less than 0.
    ArgumentException The number of elements in the source EventsCollection is greater than the available space from arrayIndex to the end of the destination array.

    GetEnumerator()

    Returns an enumerator that iterates through the EventsCollection.
    Declaration
    public IEnumerator<MidiEvent> GetEnumerator()
    Returns
    Type Description
    IEnumerator<MidiEvent> An enumerator for the EventsCollection.

    IndexOf(MidiEvent)

    Searches for the specified event and returns the zero-based index of the first occurrence within the entire EventsCollection.
    Declaration
    public int IndexOf(MidiEvent midiEvent)
    Parameters
    Type Name Description
    MidiEvent midiEvent The event to locate in the EventsCollection.
    Returns
    Type Description
    int The zero-based index of the first occurrence of event within the entire EventsCollection, if found; otherwise, –1.
    Exceptions
    Type Condition
    ArgumentNullException midiEvent is null.

    Insert(int, MidiEvent)

    Inserts an event into the collection at the specified index.
    Declaration
    public void Insert(int index, MidiEvent midiEvent)
    Parameters
    Type Name Description
    int index The zero-based index at which the event should be inserted.
    MidiEvent midiEvent The event to insert.
    Remarks
    Note that End Of Track events cannot be added into the collection since it may cause inconsistency in a track chunk structure. End Of Track event will be written to the track chunk automatically on a MIDI file writing.
    Exceptions
    Type Condition
    ArgumentNullException midiEvent is null.
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • index is less than 0.
    • index is greater than Count.

    InsertRange(int, IEnumerable<MidiEvent>)

    Inserts a set of events into the collection at the specified index.
    Declaration
    public void InsertRange(int index, IEnumerable<MidiEvent> midiEvents)
    Parameters
    Type Name Description
    int index The zero-based index at which the events should be inserted.
    IEnumerable<MidiEvent> midiEvents The events to insert.
    Remarks
    Note that End Of Track events cannot be added into the collection since it may cause inconsistency in a track chunk structure. End Of Track event will be written to the track chunk automatically on a MIDI file writing.
    Exceptions
    Type Condition
    ArgumentNullException midiEvents is null.
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • index is less than 0.
    • index is greater than Count.

    Remove(MidiEvent)

    Removes the first occurrence of a specific event from the collection.
    Declaration
    public bool Remove(MidiEvent midiEvent)
    Parameters
    Type Name Description
    MidiEvent midiEvent The event to remove from the collection. The value cannot be null.
    Returns
    Type Description
    bool true if event is successfully removed; otherwise, false. This method also returns false if event was not found in the collection.
    Exceptions
    Type Condition
    ArgumentNullException midiEvent is null.

    RemoveAll(Predicate<MidiEvent>)

    Removes all the events that match the conditions defined by the specified predicate.
    Declaration
    public int RemoveAll(Predicate<MidiEvent> match)
    Parameters
    Type Name Description
    Predicate<MidiEvent> match The Predicate<T> delegate that defines the conditions of the events to remove.
    Returns
    Type Description
    int The number of events removed from the EventsCollection.
    Exceptions
    Type Condition
    ArgumentNullException match is null.

    RemoveAt(int)

    Removes the event at the specified index of the collection.
    Declaration
    public void RemoveAt(int index)
    Parameters
    Type Name Description
    int index The zero-based index of the event to remove.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException index is less than 0; or index is equal to or greater than Count.

    Implements

    ICollection<T>
    IEnumerable<T>
    IEnumerable

    Extension Methods

    ChordsManagingUtilities.GetChords(EventsCollection, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings)
    ChordsManagingUtilities.ManageChords(EventsCollection, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings, TimedObjectsComparer)
    ChordsManagingUtilities.ProcessChords(EventsCollection, Action<Chord>, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings, ChordProcessingHint)
    ChordsManagingUtilities.ProcessChords(EventsCollection, Action<Chord>, Predicate<Chord>, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings, ChordProcessingHint)
    ChordsManagingUtilities.RemoveChords(EventsCollection, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings)
    ChordsManagingUtilities.RemoveChords(EventsCollection, Predicate<Chord>, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings)
    GetObjectsUtilities.GetObjects(EventsCollection, ObjectType, ObjectDetectionSettings)
    NotesManagingUtilities.GetNotes(EventsCollection, NoteDetectionSettings, TimedEventDetectionSettings)
    NotesManagingUtilities.ManageNotes(EventsCollection, NoteDetectionSettings, TimedEventDetectionSettings, TimedObjectsComparer)
    NotesManagingUtilities.ProcessNotes(EventsCollection, Action<Note>, NoteDetectionSettings, TimedEventDetectionSettings, NoteProcessingHint)
    NotesManagingUtilities.ProcessNotes(EventsCollection, Action<Note>, Predicate<Note>, NoteDetectionSettings, TimedEventDetectionSettings, NoteProcessingHint)
    NotesManagingUtilities.RemoveNotes(EventsCollection, NoteDetectionSettings, TimedEventDetectionSettings)
    NotesManagingUtilities.RemoveNotes(EventsCollection, Predicate<Note>, NoteDetectionSettings, TimedEventDetectionSettings)
    TimedEventsManagingUtilities.GetTimedEvents(EventsCollection, TimedEventDetectionSettings)
    TimedEventsManagingUtilities.ManageTimedEvents(EventsCollection, TimedEventDetectionSettings, TimedObjectsComparer)
    TimedEventsManagingUtilities.ProcessTimedEvents(EventsCollection, Action<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
    TimedEventsManagingUtilities.ProcessTimedEvents(EventsCollection, Action<TimedEvent>, Predicate<TimedEvent>, TimedEventDetectionSettings, TimedEventProcessingHint)
    TimedEventsManagingUtilities.RemoveTimedEvents(EventsCollection)
    TimedEventsManagingUtilities.RemoveTimedEvents(EventsCollection, Predicate<TimedEvent>, TimedEventDetectionSettings)
    TimedObjectUtilities.AddObjects(EventsCollection, IEnumerable<ITimedObject>)
    TimedObjectUtilities.ProcessObjects(EventsCollection, ObjectType, Action<ITimedObject>, ObjectDetectionSettings, ObjectProcessingHint)
    TimedObjectUtilities.ProcessObjects(EventsCollection, ObjectType, Action<ITimedObject>, Predicate<ITimedObject>, ObjectDetectionSettings, ObjectProcessingHint)
    TimedObjectUtilities.RemoveObjects(EventsCollection, ObjectType, ObjectDetectionSettings)
    TimedObjectUtilities.RemoveObjects(EventsCollection, ObjectType, Predicate<ITimedObject>, ObjectDetectionSettings)
    ChordsManagingUtilities.GetChords(IEnumerable<MidiEvent>, ChordDetectionSettings, NoteDetectionSettings, TimedEventDetectionSettings)
    GetObjectsUtilities.EnumerateObjects(IEnumerable<MidiEvent>, ObjectType, ObjectDetectionSettings)
    GetObjectsUtilities.GetObjects(IEnumerable<MidiEvent>, ObjectType, ObjectDetectionSettings)
    NotesManagingUtilities.GetNotes(IEnumerable<MidiEvent>, NoteDetectionSettings, TimedEventDetectionSettings)
    PlaybackUtilities.GetPlayback(IEnumerable<MidiEvent>, TempoMap, IOutputDevice, PlaybackSettings)
    PlaybackUtilities.GetPlayback(IEnumerable<MidiEvent>, TempoMap, PlaybackSettings)
    In this article
    Back to top 2024 / Generated by DocFX