|
| | FixedPpqTempoMap (units::precise_sample_rate_t sampleRate) |
| | Construct a new FixedPpqTempoMap object.
|
| void | set_sample_rate (units::precise_sample_rate_t sampleRate) |
| | Set the sample rate.
|
| void | add_tempo_event (units::tick_t tick, units::bpm_t bpm, CurveType curve) |
| | Add a tempo event.
|
|
void | remove_tempo_event (units::tick_t tick) |
| | Remove a tempo event at the specified tick.
|
| void | add_time_signature_event (units::tick_t tick, int numerator, int denominator) |
| | Add a time signature event.
|
|
void | remove_time_signature_event (units::tick_t tick) |
| | Remove a time signature event at the specified tick.
|
|
auto | tick_to_seconds (TimelineTick tick) const -> units::precise_second_t |
| | Convert timeline ticks to seconds.
|
| units::precise_sample_t | tick_to_samples (TimelineTick tick) const |
| | Convert timeline ticks to samples.
|
| units::sample_t | tick_to_samples_rounded (TimelineTick tick) const |
|
TimelineTick | seconds_to_tick (units::precise_second_t seconds) const |
| | Convert seconds to timeline ticks.
|
| TimelineTick | samples_to_tick (units::precise_sample_t samples) const |
| | Convert samples to timeline ticks.
|
| TimeSignatureEvent | time_signature_at_tick (units::tick_t tick) const |
| | Get the time signature event active at the given tick.
|
| units::bpm_t | tempo_at_tick (units::tick_t tick) const |
| | Get the tempo (BPM) active at the given tick.
|
| std::span< const TempoEvent > | tempo_events () const noexcept |
| | Read-only view of all inserted tempo events, sorted ascending by tick.
|
| std::span< const TimeSignatureEvent > | time_signature_events () const noexcept |
| | Read-only view of all inserted time signature events, sorted ascending by tick.
|
| MusicalPosition | tick_to_musical_position (units::tick_t tick) const |
| | Convert ticks to musical position (bar:beat:sixteenth:tick).
|
|
MusicalPosition | samples_to_musical_position (units::sample_t samples) const |
| TimelineTickI | musical_position_to_tick (const MusicalPosition &pos) const |
| | Convert musical position to ticks.
|
| auto | get_sample_rate () const |
| | Get current sample rate.
|
| units::bpm_t | base_bpm () const |
| | Base tempo at tick 0.
|
| void | set_base_bpm (units::bpm_t bpm) |
| | Set the base tempo at tick 0 and recompute the lead-segment timing.
|
| const TimeSignatureEvent & | base_time_signature () const |
| | Base time signature at tick 0.
|
| void | set_base_time_signature (int numerator, int denominator) |
| | Set the base time signature at tick 0.
|
| std::span< const TimeSignatureEvent > | effective_time_signature_events () const noexcept |
| | Read-only view of the time signature events with the base signature prepended at tick 0 when no inserted event sits at tick 0.
|
template<units::tick_t::NTTP PPQ>
class zrythm::dsp::FixedPpqTempoMap< PPQ >
Manages tempo and time signature events for a DAW timeline.
The FixedPpqTempoMap class handles:
- Tempo events (constant and linear ramps)
- Time signature changes
- Conversion between musical time (ticks) and absolute time (seconds/samples)
- Conversion between ticks and musical position (bar:beat:sixteenth:tick)
All tempo events are stored in musical time (ticks) and automatically adjust to time signature changes. A precondition for this is that tempo events are only added after all time signature events are added.
- Note
- The map always carries a base tempo (base_bpm_) and base time signature (base_time_sig_) anchored at tick 0. These govern the region from tick 0 up to the first inserted event (as a constant segment), or the whole timeline if no events exist. An inserted event at tick 0 shadows the base for the region it covers.
- Template Parameters
-
| PPQ | Pulses (ticks) per quarter note |
Definition at line 41 of file tempo_map.h.
template<units::tick_t::NTTP PPQ>
Read-only view of the time signature events with the base signature prepended at tick 0 when no inserted event sits at tick 0.
Backed by a cache (effective_time_sig_events_) rebuilt on mutation, so the read path is allocation-free.
- Note
- Realtime safety relies on a caller-enforced contract: the cache must not be mutated while the audio thread is mid-read. All mutation entry points (add/remove/clear/set_base and project reload) must run while the engine is stopped or paused.
Definition at line 279 of file tempo_map.h.