Search Results for

    Show / Hide Table of Contents

    Class MidiClock

    MIDI clock used to drive playback or any timer-based object.
    Inheritance
    object
    MidiClock
    Implements
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Melanchall.DryWetMidi.Multimedia
    Assembly: Melanchall.DryWetMidi.dll
    Syntax
    public sealed class MidiClock : IDisposable

    Constructors

    MidiClock(bool, TickGenerator, TimeSpan)

    Initializes a new instance of the MidiClock with the specified value indicating whether first tick should be generated immediately after clock started, and tick generator.
    Declaration
    public MidiClock(bool startImmediately, TickGenerator tickGenerator, TimeSpan interval)
    Parameters
    Type Name Description
    bool startImmediately A value indicating whether first tick should be generated immediately after clock started.
    TickGenerator tickGenerator Tick generator used as timer firing at the specified interval. Null for no tick generator.
    TimeSpan interval Interval of clock's ticking.

    Properties

    CurrentTime

    Gets the current time of clock as TimeSpan.
    Declaration
    public TimeSpan CurrentTime { get; }
    Property Value
    Type Description
    TimeSpan

    Interval

    Gets the interval of the current clock's ticking.
    Declaration
    public TimeSpan Interval { get; }
    Property Value
    Type Description
    TimeSpan

    IsRunning

    Gets a value indicating whether MIDI clock is currently running or not.
    Declaration
    public bool IsRunning { get; }
    Property Value
    Type Description
    bool

    Speed

    Gets or sets the speed of clock, i.e. the speed of current time changing.
    Declaration
    public double Speed { get; set; }
    Property Value
    Type Description
    double
    Exceptions
    Type Condition
    ArgumentOutOfRangeException value is negative.
    ObjectDisposedException The current MidiClock is disposed.

    Methods

    Dispose()

    Releases all resources used by the current MidiClock.
    Declaration
    public void Dispose()

    ~MidiClock()

    Finalizes the current instance of the MidiClock.
    Declaration
    protected ~MidiClock()

    ResetCurrentTime()

    Resets the current time of the clock setting it to zero.
    Declaration
    public void ResetCurrentTime()
    Exceptions
    Type Condition
    ObjectDisposedException The current MidiClock is disposed.

    Restart()

    Stops, sets current time to zero and starts the clock.
    Declaration
    public void Restart()
    Exceptions
    Type Condition
    ObjectDisposedException The current MidiClock is disposed.

    SetCurrentTime(TimeSpan)

    Sets the current time of the clock.
    Declaration
    public void SetCurrentTime(TimeSpan time)
    Parameters
    Type Name Description
    TimeSpan time New current time of the clock.
    Exceptions
    Type Condition
    ObjectDisposedException The current MidiClock is disposed.

    Start()

    Starts/resumes the clock.
    Declaration
    public void Start()
    Exceptions
    Type Condition
    ObjectDisposedException The current MidiClock is disposed.

    Stop()

    Stops the clock.Current time will not be changed.
    Declaration
    public void Stop()
    Exceptions
    Type Condition
    ObjectDisposedException The current MidiClock is disposed.

    Tick()

    Generates new clock's tick manually without pulse from tick generator.
    Declaration
    public void Tick()

    Events

    Ticked

    Occurs when new tick generated.
    Declaration
    public event EventHandler Ticked
    Event Type
    Type Description
    EventHandler

    Implements

    IDisposable
    In this article
    Back to top 2025 / Generated by DocFX