Search Results for

    Show / Hide Table of Contents

    Class TempoMapManager

    Provides a way to manage tempo map of a MIDI file. More info in the Tempo map article.
    Inheritance
    object
    TempoMapManager
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Interaction
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class TempoMapManager : IDisposable

    Constructors

    TempoMapManager()

    Initializes a new instance of the TempoMapManager that can be used to manage new tempo map with the default time division (96 ticks per quarter note).
    Declaration
    public TempoMapManager()

    TempoMapManager(TimeDivision)

    Initializes a new instance of the TempoMapManager with the specified time division.
    Declaration
    public TempoMapManager(TimeDivision timeDivision)
    Parameters
    Type Name Description
    TimeDivision timeDivision Time division of a new tempo that will be managed by this manager.
    Exceptions
    Type Condition
    ArgumentNullException timeDivision is null.

    TempoMapManager(TimeDivision, IEnumerable<EventsCollection>)

    Initializes a new instance of the TempoMapManager with the specified time division and events collections.
    Declaration
    public TempoMapManager(TimeDivision timeDivision, IEnumerable<EventsCollection> eventsCollections)
    Parameters
    Type Name Description
    TimeDivision timeDivision MIDI file time division which specifies the meaning of the time used by events of the file.
    IEnumerable<EventsCollection> eventsCollections Collection of EventsCollection which hold events that represent tempo map of a MIDI file.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • timeDivision is null.
    • eventsCollections is null.
    ArgumentException eventsCollections is empty.

    Properties

    TempoMap

    Gets current tempo map built by the TempoMapManager.
    Declaration
    public TempoMap TempoMap { get; }
    Property Value
    Type Description
    TempoMap

    Methods

    ClearTempo(ITimeSpan)

    Removes all changes of tempo that occurred since the specified time.
    Declaration
    public void ClearTempo(ITimeSpan startTime)
    Parameters
    Type Name Description
    ITimeSpan startTime Time to remove changes of tempo since.
    Exceptions
    Type Condition
    ArgumentNullException startTime is null.

    ClearTempo(ITimeSpan, ITimeSpan)

    Removes all changes of tempo that occurred between the specified times.
    Declaration
    public void ClearTempo(ITimeSpan startTime, ITimeSpan endTime)
    Parameters
    Type Name Description
    ITimeSpan startTime Start of time range to remove changes of tempo in.
    ITimeSpan endTime End of time range to remove changes of tempo in.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • startTime is null.
    • endTime is null.

    ClearTempo(long)

    Removes all changes of tempo that occurred since the specified time.
    Declaration
    public void ClearTempo(long startTime)
    Parameters
    Type Name Description
    long startTime Time to remove changes of tempo since.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException startTime is negative.

    ClearTempo(long, long)

    Removes all changes of tempo that occurred between the specified times.
    Declaration
    public void ClearTempo(long startTime, long endTime)
    Parameters
    Type Name Description
    long startTime Start of time range to remove changes of tempo in.
    long endTime End of time range to remove changes of tempo in.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • startTime is negative.
    • endTime is negative.

    ClearTempoMap()

    Clears current tempo map removing all changes of tempo and time signature.
    Declaration
    public void ClearTempoMap()

    ClearTimeSignature(ITimeSpan)

    Removes all changes of time signature that occurred since the specified time.
    Declaration
    public void ClearTimeSignature(ITimeSpan startTime)
    Parameters
    Type Name Description
    ITimeSpan startTime Time to remove changes of time signature since.
    Exceptions
    Type Condition
    ArgumentNullException startTime is null.

    ClearTimeSignature(ITimeSpan, ITimeSpan)

    Removes all changes of time signature that occurred between the specified times.
    Declaration
    public void ClearTimeSignature(ITimeSpan startTime, ITimeSpan endTime)
    Parameters
    Type Name Description
    ITimeSpan startTime Start of time range to remove changes of time signature in.
    ITimeSpan endTime End of time range to remove changes of time signature in.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • startTime is null.
    • endTime is null.

    ClearTimeSignature(long)

    Removes all changes of time signature that occurred since the specified time.
    Declaration
    public void ClearTimeSignature(long startTime)
    Parameters
    Type Name Description
    long startTime Time to remove changes of time signature since.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException startTime is negative.

    ClearTimeSignature(long, long)

    Removes all changes of time signature that occurred between the specified times.
    Declaration
    public void ClearTimeSignature(long startTime, long endTime)
    Parameters
    Type Name Description
    long startTime Start of time range to remove changes of time signature in.
    long endTime End of time range to remove changes of time signature in.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    One of the following errors occurred:

    • startTime is negative.
    • endTime is negative.

    Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
    Declaration
    public void Dispose()

    ReplaceTempoMap(TempoMap)

    Replaces current tempo map with the specified one.
    Declaration
    public void ReplaceTempoMap(TempoMap tempoMap)
    Parameters
    Type Name Description
    TempoMap tempoMap Tempo map to replace the current one.
    Exceptions
    Type Condition
    ArgumentNullException tempoMap is null.

    SaveChanges()

    Saves tempo map changes that were made with the TempoMapManager updating underlying events collections.
    Declaration
    public void SaveChanges()
    Remarks
    This method will rewrite content of all events collections were used to construct the current TempoMapManager with events were managed by underlying TimedObjectsManager objects of this manager. Also all delta-times of wrapped events will be recalculated according to the Time of event wrappers.

    SetTempo(ITimeSpan, Tempo)

    Sets new tempo that will last from the specified time until next change of tempo.
    Declaration
    public void SetTempo(ITimeSpan time, Tempo tempo)
    Parameters
    Type Name Description
    ITimeSpan time Time to set the new tempo at.
    Tempo tempo New tempo that will last from the specified time until next change of tempo.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • time is null.
    • tempo is null.

    SetTempo(long, Tempo)

    Sets new tempo that will last from the specified time until next change of tempo.
    Declaration
    public void SetTempo(long time, Tempo tempo)
    Parameters
    Type Name Description
    long time Time to set the new tempo at.
    Tempo tempo New tempo that will last from the specified time until next change of tempo.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException time is negative.
    ArgumentNullException tempo is null.

    SetTimeSignature(ITimeSpan, TimeSignature)

    Sets new time signature that will last from the specified time until next change of time signature.
    Declaration
    public void SetTimeSignature(ITimeSpan time, TimeSignature timeSignature)
    Parameters
    Type Name Description
    ITimeSpan time Time to set the new time signature at.
    TimeSignature timeSignature New time signature that will last from the specified time until next change of time signature.
    Exceptions
    Type Condition
    ArgumentNullException

    One of the following errors occurred:

    • time is null.
    • timeSignature is null.

    SetTimeSignature(long, TimeSignature)

    Sets new time signature that will last from the specified time until next change of time signature.
    Declaration
    public void SetTimeSignature(long time, TimeSignature timeSignature)
    Parameters
    Type Name Description
    long time Time to set the new time signature at.
    TimeSignature timeSignature New time signature that will last from the specified time until next change of time signature.
    Exceptions
    Type Condition
    ArgumentOutOfRangeException time is negative.
    ArgumentNullException timeSignature is null.

    Implements

    IDisposable

    See Also

    TempoMap
    In this article
    Back to top 2024 / Generated by DocFX