Module: Musa::Clock

Included in:
All
Defined in:
lib/musa-dsl/transport/clock.rb,
lib/musa-dsl/transport/timer.rb,
lib/musa-dsl/transport/dummy-clock.rb,
lib/musa-dsl/transport/timer-clock.rb,
lib/musa-dsl/transport/input-midi-clock.rb,
lib/musa-dsl/transport/external-tick-clock.rb

Overview

Clock and timing infrastructure for musical transport.

The Clock module provides the foundation for all timing mechanisms in Musa DSL. Clocks generate regular ticks that drive the sequencer forward, and can be sourced from internal timers, external MIDI clock, or manual control.

Architecture

  • Clock (base class): Abstract interface for all clock implementations
  • TimerClock: Internal high-precision timer-based clock
  • InputMidiClock: Synchronized to external MIDI Clock messages
  • ExternalTickClock: Manually triggered ticks (for testing/integration)
  • DummyClock: Simplified clock for testing

Clock Lifecycle

  1. Creation: Clock instance created with configuration
  2. Registration: Callbacks registered (on_start, on_stop, on_change_position)
  3. Running: Clock.run called (blocks, generates ticks via yield)
  4. Termination: Clock.terminate called to stop

Defined Under Namespace

Classes: Clock, DummyClock, ExternalTickClock, InputMidiClock, Timer, TimerClock