Zrythm v2.0.0-alpha.1
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::arrangement::Clip Class Referenceabstract

Intermediate base class for all clip types. More...

#include <src/structure/arrangement/clip.h>

Inheritance diagram for zrythm::structure::arrangement::Clip:
Collaboration diagram for zrythm::structure::arrangement::Clip:

Public Member Functions

dsp::TimelinePositionposition () const override
dsp::ContentTimeWarpcontentWarp () const
dsp::TimebaseProvider * timebaseProvider () const
Q_INVOKABLE void setLengthTicks (double ticks)
Q_INVOKABLE QList< double > loopPointTimelineTicks (double displayEndTicks) const
 Timeline delta-tick positions of each loop wrap point.
double timelineLengthTicks () const
 Warp-aware length of this clip in timeline ticks.
Q_SIGNAL void timelineLengthTicksChanged ()
units::sample_t get_end_position_samples (bool end_position_inclusive) const
 Returns the end position of this clip in timeline samples.
units::sample_t get_sample_duration () const
 Returns the duration of this clip in timeline samples (end minus start), warp-aware.
bool is_hit (const units::sample_t frames, bool object_end_pos_inclusive=false) const
 Returns whether the clip is hit by the given timeline position.
bool is_hit_by_range (std::pair< units::sample_t, units::sample_t > global_frames, bool range_start_inclusive=true, bool range_end_inclusive=true, bool object_end_pos_inclusive=false) const
 Whether the clip is hit by the given range.
dsp::ContentPositionclipStartPosition () const
dsp::ContentPositionloopStartPosition () const
dsp::ContentPositionloopEndPosition () const
bool trackBounds () const
void setTrackBounds (bool track)
Q_SIGNAL void trackBoundsChanged (bool track)
void set_loop_range (dsp::ContentTick clip_start, dsp::ContentTick loop_start, dsp::ContentTick loop_end)
 Set the three loop positions atomically, bypassing the per-position clamping constraints.
bool looped () const
Q_SIGNAL void loopedChanged ()
Q_SIGNAL void contentChanged ()
 Emitted when the clip's content changes.
Q_SIGNAL void loopablePropertiesChanged ()
 Emitted when any loop-related property changes.
int get_num_loops (bool count_incomplete) const
 Returns the number of loops, optionally including incomplete ones.
dsp::ContentTick get_loop_length_in_ticks () const
 Returns the length of the loop in ticks.
virtual void shift_all_children (dsp::ContentTick delta)=0
 Shifts all child objects by delta content ticks.
virtual std::optional< dsp::ContentTick > first_child_position () const =0
 Returns the position of the first child, if any.
Public Member Functions inherited from zrythm::structure::arrangement::ArrangerObject
auto type () const
dsp::ContentPositionlength () const
ArrangerObjectNamename () const
ArrangerObjectColorcolor () const
ArrangerObjectMuteFunctionalitymute () const
Q_SIGNAL void propertiesChanged ()
 Emitted when any of the properties of the object changed.
ArrangerObjectparentObject () const
void setParentObject (ArrangerObject *object)
Q_SIGNAL void parentObjectChanged (QObject *parentObject)
const dsp::TempoMap & get_tempo_map () const
const dsp::TempoMapWrapperget_tempo_map_wrapper () const
virtual std::vector< ArrangerObjectListModel * > get_child_list_models () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject >
 UuidIdentifiableObject (QObject *parent=nullptr)
auto get_uuid () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableBase
 UuidIdentifiableBase (QObject *parent=nullptr)
 UuidIdentifiableBase (const QUuid &id, QObject *parent=nullptr)
QUuid raw_uuid () const

Protected Member Functions

 Clip (Type type, const dsp::TempoMapWrapper &tempo_map_wrapper, QObject *parent=nullptr) noexcept
Protected Member Functions inherited from zrythm::structure::arrangement::ArrangerObject
 ArrangerObject (Type type, const dsp::TempoMapWrapper &tempo_map_wrapper, ArrangerObjectFeatures features, QObject *parent=nullptr) noexcept
 Construct a new ArrangerObject.
Protected Member Functions inherited from zrythm::utils::UuidIdentifiableBase
void set_raw_uuid (const QUuid &id)

Properties

zrythm::dsp::ContentTimeWarpcontentWarp
zrythm::dsp::timebase::TimebaseProvidertimebaseProvider
double timelineLengthTicks
zrythm::dsp::ContentPositionclipStartPosition
zrythm::dsp::ContentPositionloopStartPosition
zrythm::dsp::ContentPositionloopEndPosition
bool trackBounds
bool looped
Properties inherited from zrythm::structure::arrangement::ArrangerObject
QML_ELEMENT zrythm::structure::arrangement::ArrangerObjectparentObject
zrythm::structure::arrangement::ArrangerObject::Type type
zrythm::dsp::Positionposition
zrythm::dsp::ContentPositionlength
zrythm::structure::arrangement::ArrangerObjectNamename
zrythm::structure::arrangement::ArrangerObjectColorcolor
zrythm::structure::arrangement::ArrangerObjectMuteFunctionalitymute

Friends

void init_from (Clip &obj, const Clip &other, utils::ObjectCloneType clone_type)
void to_json (nlohmann::json &j, const Clip &clip)
void from_json (const nlohmann::json &j, Clip &clip)

Additional Inherited Members

Public Types inherited from zrythm::structure::arrangement::ArrangerObject
enum class  Type : std::uint8_t {
  MidiClip , AudioClip , ChordClip , AutomationClip ,
  MidiControlEvent , MidiNote , ChordObject , ScaleObject ,
  Marker , AutomationPoint , AudioSourceObject , TempoObject ,
  TimeSignatureObject
}
 The type of the object. More...
Public Types inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject >
using uuid_base_type
 Exposes the CRTP parameter for concept checking.
Protected Types inherited from zrythm::structure::arrangement::ArrangerObject
enum class  ArrangerObjectFeatures : std::uint8_t {
  Bounds = 1 << 0 , Name = 1 << 1 , Color = 1 << 2 , Mute = 1 << 3 ,
  ClipOwned = 1 << 4
}

Detailed Description

Intermediate base class for all clip types.

A Clip is a segment of the timeline with its own content coordinate system. It owns the members that only exist on clips: ContentTimeWarp, TimebaseProvider, and loop range positions. These were formerly split across ArrangerObjectBounds and ArrangerObjectLoopRange, which have been deleted.

Common members (position, length, name, mute, color) remain on ArrangerObject via feature flags.

Definition at line 36 of file clip.h.

Member Function Documentation

◆ clipStartPosition()

dsp::ContentPosition * zrythm::structure::arrangement::Clip::clipStartPosition ( ) const
inline

Definition at line 136 of file clip.h.

◆ contentChanged()

Q_SIGNAL void zrythm::structure::arrangement::Clip::contentChanged ( )

Emitted when the clip's content changes.

Each concrete Clip subclass forwards its ArrangerObjectListModel's contentChanged signal to this signal in its constructor, so consumers (e.g. canvas items) can connect uniformly without knowing the specific clip type or its child models.

◆ contentWarp()

dsp::ContentTimeWarp * zrythm::structure::arrangement::Clip::contentWarp ( ) const
inline

Definition at line 67 of file clip.h.

◆ first_child_position()

virtual std::optional< dsp::ContentTick > zrythm::structure::arrangement::Clip::first_child_position ( ) const
pure virtual

Returns the position of the first child, if any.

Used by undo commands to capture/restore child positions.

Implemented in zrythm::structure::arrangement::MidiClip.

◆ get_end_position_samples()

units::sample_t zrythm::structure::arrangement::Clip::get_end_position_samples ( bool end_position_inclusive) const

Returns the end position of this clip in timeline samples.

Parameters
end_position_inclusiveIf true, returns the exact end sample; if false, returns one sample before (for half-open interval queries).

◆ get_loop_length_in_ticks()

dsp::ContentTick zrythm::structure::arrangement::Clip::get_loop_length_in_ticks ( ) const
inline

Returns the length of the loop in ticks.

Definition at line 207 of file clip.h.

◆ loopablePropertiesChanged()

Q_SIGNAL void zrythm::structure::arrangement::Clip::loopablePropertiesChanged ( )

Emitted when any loop-related property changes.

Fired in addition to the more specific signals (loopedChanged, trackBoundsChanged) so consumers can trigger a single recalculation.

◆ loopEndPosition()

dsp::ContentPosition * zrythm::structure::arrangement::Clip::loopEndPosition ( ) const
inline

Definition at line 144 of file clip.h.

◆ loopPointTimelineTicks()

Q_INVOKABLE QList< double > zrythm::structure::arrangement::Clip::loopPointTimelineTicks ( double displayEndTicks) const

Timeline delta-tick positions of each loop wrap point.

Returns positions relative to the clip start, suitable for placing loop markers in a clip view.

Parameters
displayEndTicksUpper bound (exclusive) for returned positions, typically max(timelineLengthTicks, display extent).

◆ loopStartPosition()

dsp::ContentPosition * zrythm::structure::arrangement::Clip::loopStartPosition ( ) const
inline

Definition at line 140 of file clip.h.

◆ position()

dsp::TimelinePosition * zrythm::structure::arrangement::Clip::position ( ) const
inlineoverridevirtual

Reimplemented from zrythm::structure::arrangement::ArrangerObject.

Definition at line 58 of file clip.h.

◆ set_loop_range()

void zrythm::structure::arrangement::Clip::set_loop_range ( dsp::ContentTick clip_start,
dsp::ContentTick loop_start,
dsp::ContentTick loop_end )

Set the three loop positions atomically, bypassing the per-position clamping constraints.

Each position's dsp::Position::setTicks constraint normally clamps against the current sibling values, which corrupts values when setting an interdependent triplet sequentially (e.g. expanding loop_start beyond the current loop_end). This method writes all three without per-set clamping, so an interdependent target is applied as-is.

Inputs are clamped holistically to the loop invariants (loop_end >= max(clip_start, loop_start) + 1, all >= 0); already-valid triplets are applied unchanged.

If length-tracking (trackBounds) is on, it is disabled for the duration of the set so the explicit values are not overwritten by the length-tracking connection. Tracking is left disabled; callers that want it re-engaged (e.g. when the result is the default range) must call setTrackBounds themselves.

◆ setLengthTicks()

Q_INVOKABLE void zrythm::structure::arrangement::Clip::setLengthTicks ( double ticks)
inline

Definition at line 75 of file clip.h.

◆ shift_all_children()

virtual void zrythm::structure::arrangement::Clip::shift_all_children ( dsp::ContentTick delta)
pure virtual

Shifts all child objects by delta content ticks.

Implemented in zrythm::structure::arrangement::MidiClip.

◆ timebaseProvider()

dsp::TimebaseProvider * zrythm::structure::arrangement::Clip::timebaseProvider ( ) const
inline

Definition at line 69 of file clip.h.

◆ timelineLengthTicks()

double zrythm::structure::arrangement::Clip::timelineLengthTicks ( ) const

Warp-aware length of this clip in timeline ticks.

Converts the content-space length through ContentTimeWarp, so the result may differ from length()->ticks() when there are tempo changes inside the clip.

◆ trackBounds()

bool zrythm::structure::arrangement::Clip::trackBounds ( ) const
inline

Definition at line 149 of file clip.h.

Property Documentation

◆ clipStartPosition

zrythm::dsp::ContentPosition * zrythm::structure::arrangement::Clip::clipStartPosition
read

Definition at line 44 of file clip.h.

◆ contentWarp

zrythm::dsp::ContentTimeWarp * zrythm::structure::arrangement::Clip::contentWarp
read

Definition at line 39 of file clip.h.

◆ looped

bool zrythm::structure::arrangement::Clip::looped
read

Definition at line 50 of file clip.h.

◆ loopEndPosition

zrythm::dsp::ContentPosition * zrythm::structure::arrangement::Clip::loopEndPosition
read

Definition at line 48 of file clip.h.

◆ loopStartPosition

zrythm::dsp::ContentPosition * zrythm::structure::arrangement::Clip::loopStartPosition
read

Definition at line 46 of file clip.h.

◆ timebaseProvider

zrythm::dsp::timebase::TimebaseProvider * zrythm::structure::arrangement::Clip::timebaseProvider
read

Definition at line 40 of file clip.h.

◆ timelineLengthTicks

double zrythm::structure::arrangement::Clip::timelineLengthTicks
read

Definition at line 41 of file clip.h.

◆ trackBounds

bool zrythm::structure::arrangement::Clip::trackBounds
readwrite

Definition at line 49 of file clip.h.


The documentation for this class was generated from the following file:
  • src/structure/arrangement/clip.h