Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
time_warp_map.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <vector>
7
8#include "utils/units.h"
9
10namespace zrythm::dsp
11{
12
21{
23 units::sample_t source_frame;
25 units::sample_t output_frame;
26};
27
43{
44 std::vector<WarpAnchor> anchors;
45
47 units::sample_t source_length{};
48
50 units::sample_t output_length{};
51
62 [[nodiscard]] bool is_valid () const noexcept;
63};
64
75[[nodiscard]] bool
76is_sample_space_identity (
77 std::span<const WarpAnchor> anchors,
78 units::sample_t tolerance = units::samples (2));
79
80} // namespace zrythm::dsp
A monotonic time-warp mapping from source samples to output samples.
units::sample_t output_length
Total output frames (length of the stretched result).
units::sample_t source_length
Total source frames (length of the input clip).
bool is_valid() const noexcept
Validates the invariants of a well-formed warp map.
One anchor in a source→output time-warp mapping.
units::sample_t source_frame
Frame index in the source (clip) audio.
units::sample_t output_frame
Frame index in the output (stretched) audio, relative to clip start.