Detailed Description
A MIDI clock running at its own tempo, with its own transport.
Start sends Song Position 0, Start and a first clock; Continue sends the current Song Position, Continue and a first clock; Stop sends Stop and keeps the position for Continue. Clocks are only sent while running.
When stopped, four taps (one bar of 4/4) start the clock on the beat after the last tap, at the tapped tempo.
A positive offset delays the start and shifts the phase of a running clock; changing it while running moves the next clocks by the difference. There is no timeline to be early against, so negative offsets count as 0.
Ticks are dated from the previous one, not from the time process() is called: a late call sends the overdue clocks at once with their due dates, and the clock does not drift.
Public Member Functions | |
| double | tempo (const free_clock_params &p) const noexcept |
| The tempo before nudge and rate: the tapped one, or the BPM control. | |
| int64_t | period_ns (const free_clock_params &p) const noexcept |
| bool | running () const noexcept |
| bool | starting () const noexcept |
| bool | count_in_pending () const noexcept |
| int64_t | song_position () const noexcept |
| Position in MIDI beats (16th notes) of the receiver: 6 clocks each. | |
| const tap_tempo & | taps () const noexcept |
| int64_t | next_deadline (const free_clock_params &p) const noexcept |
| When process() next has something to send. | |
| template<typename Send > | |
| void | command (transport_command c, int64_t now, const free_clock_params &p, Send &&send) |
| void | tap (int64_t now, const free_clock_params &p) noexcept |
| template<typename Send > | |
| void | process (int64_t now, const free_clock_params &p, Send &&send) |
Sends what is due at or before now. | |
Static Public Attributes | |
| static constexpr int | count_in_taps = 4 |
| static constexpr int64_t | never = std::numeric_limits<int64_t>::max() |
The documentation for this struct was generated from the following file: