Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::commands::SetClipLoopPointsCommand Class Reference

Sets a clip's clip-start / loop-start / loop-end to absolute content positions, undoably. More...

#include <src/commands/set_clip_loop_points_command.h>

Inheritance diagram for zrythm::commands::SetClipLoopPointsCommand:
Collaboration diagram for zrythm::commands::SetClipLoopPointsCommand:

Data Structures

struct  Snapshot
 Snapshot of the three loop positions plus the track-bounds flag. More...

Public Member Functions

 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.
void undo () override
void redo () override

Static Public Member Functions

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 written atomically (no per-set clamping via Clip::set_loop_range), and tracking is re-engaged when the result is the default range (0, 0, length).
static Snapshot snapshotOf (const structure::arrangement::Clip &clip)
 Read a snapshot of clip's current loop-points state.

Detailed Description

Sets a clip's clip-start / loop-start / loop-end to absolute content positions, undoably.

The command is immutable once constructed: it captures the clip's current state as before_ at construction and applies the given target on redo(). There is deliberately no "update the target while on the stack" pathway — live dragging is handled by mutating the clip directly during the gesture and constructing (and pushing) a single command at the end (see actions::ClipOperator).

The clip is held by a reference-counted TypedUuidReference, so it stays alive while the command is on the undo stack.

Definition at line 29 of file set_clip_loop_points_command.h.

Member Function Documentation

◆ applyToClip()

void zrythm::commands::SetClipLoopPointsCommand::applyToClip ( structure::arrangement::Clip & clip,
dsp::ContentTick clip_start,
dsp::ContentTick loop_start,
dsp::ContentTick loop_end )
static

Apply a loop-points target to clip directly: length-tracking is disabled, the three positions are written atomically (no per-set clamping via Clip::set_loop_range), and tracking is re-engaged when the result is the default range (0, 0, length).

Used by redo() and by ClipOperator's live drag preview so the committed state always matches the preview.


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