Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
set_clip_loop_points_command.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/tick_types.h"
7#include "structure/arrangement/clip.h"
8#include "utils/typed_uuid_reference.h"
9
10#include <QUndoCommand>
11
12namespace zrythm::commands
13{
14
29class SetClipLoopPointsCommand : public QUndoCommand
30{
31public:
35 struct Snapshot
36 {
37 dsp::ContentTick clip_start{};
38 dsp::ContentTick loop_start{};
39 dsp::ContentTick loop_end{};
40 bool track_bounds{ true };
41 };
42
47 dsp::ContentTick new_clip_start,
48 dsp::ContentTick new_loop_start,
49 dsp::ContentTick new_loop_end);
50
51 void undo () override;
52 void redo () override;
53
60 static void applyToClip (
62 dsp::ContentTick clip_start,
63 dsp::ContentTick loop_start,
64 dsp::ContentTick loop_end);
65
68
69private:
71 Snapshot before_;
72 Snapshot after_;
73};
74
75} // namespace zrythm::commands
static Snapshot snapshotOf(const structure::arrangement::Clip &clip)
Read a snapshot of clip's current loop-points state.
SetClipLoopPointsCommand(utils::TypedUuidReference< structure::arrangement::Clip > clip, dsp::ContentTick new_clip_start, dsp::ContentTick new_loop_start, dsp::ContentTick new_loop_end)
Capture before_ from clip's current state; redo() will move it to the given target.
static void applyToClip(structure::arrangement::Clip &clip, dsp::ContentTick clip_start, dsp::ContentTick loop_start, dsp::ContentTick loop_end)
Apply a loop-points target to clip directly: length-tracking is disabled, the three positions are wri...
Intermediate base class for all clip types.
Definition clip.h:37
Typed, reference-counted UUID reference into an IObjectRegistry.
Snapshot of the three loop positions plus the track-bounds flag.