Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::TimeWarpMap Struct Reference

A monotonic time-warp mapping from source samples to output samples. More...

#include <src/dsp/time_warp_map.h>

Public Member Functions

bool is_valid () const noexcept
 Validates the invariants of a well-formed warp map.

Data Fields

std::vector< WarpAnchoranchors
units::sample_t source_length {}
 Total source frames (length of the input clip).
units::sample_t output_length {}
 Total output frames (length of the stretched result).

Detailed Description

A monotonic time-warp mapping from source samples to output samples.

This is the single input consumed by every time-stretch engine, regardless of how the mapping was produced (the tempo map for auto-timestretch, or in future user-defined warp markers). Keeping the map in the sample domain means engines never need to know about tempo maps or musical time.

Anchors must be sorted ascending by WarpAnchor::source_frame and strictly increasing in WarpAnchor::output_frame. The first anchor must map 0 → 0 and the last must map source_lengthoutput_length.

See also
to_time_warp_map()

Definition at line 42 of file time_warp_map.h.

Member Function Documentation

◆ is_valid()

bool zrythm::dsp::TimeWarpMap::is_valid ( ) const
nodiscardnoexcept

Validates the invariants of a well-formed warp map.

Checks that anchors are non-empty, sorted ascending by source frame, strictly increasing in output frame, and that the endpoints match source_length and output_length (both of which must be positive).

Returns
true if the map is well-formed and safe to feed to an engine.

Field Documentation

◆ anchors

std::vector<WarpAnchor> zrythm::dsp::TimeWarpMap::anchors

Definition at line 44 of file time_warp_map.h.

◆ output_length

units::sample_t zrythm::dsp::TimeWarpMap::output_length {}

Total output frames (length of the stretched result).

Definition at line 50 of file time_warp_map.h.

◆ source_length

units::sample_t zrythm::dsp::TimeWarpMap::source_length {}

Total source frames (length of the input clip).

Definition at line 47 of file time_warp_map.h.


The documentation for this struct was generated from the following file: