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

An observable, serializable musical position stored as ticks. More...

#include <src/dsp/position.h>

Inheritance diagram for zrythm::dsp::Position:
Collaboration diagram for zrythm::dsp::Position:

Public Types

using ConstraintFunction
 Function that clamps/adjusts tick values on setTicks (e.g.

Signals

void positionChanged ()

Public Member Functions

 Position (QObject *parent=nullptr)
 Construct a Position without a value constraint.
 Position (ConstraintFunction constraint, QObject *parent=nullptr)
 Construct a Position with a value constraint.
double ticks () const
 The stored tick value (meaning depends on owner context).
void setTicks (double ticks)
void set_ticks_without_constraint (double ticks)
 Set ticks without applying constraint_.
Q_INVOKABLE void addTicks (double ticks)

Properties

double ticks

Friends

void to_json (nlohmann::json &j, const Position &pos)
void from_json (const nlohmann::json &j, Position &pos)

Detailed Description

An observable, serializable musical position stored as ticks.

The stored value's meaning (timeline ticks vs. content ticks) is determined by the owner context — Position does not encode coordinate space. Callers know from the property/variable name whether they are working with a timeline position (e.g. position_) or a content-space value (e.g. length_, loop_start_pos_).

Non-atomic: arranger-object positions are never read from the audio thread. For Transport marker positions, see Transport's farbot::RealtimeObject snapshot which pre-computes samples for RT access.

Definition at line 32 of file position.h.

Member Typedef Documentation

◆ ConstraintFunction

Initial value:
std::function<units::precise_tick_t (units::precise_tick_t)>

Function that clamps/adjusts tick values on setTicks (e.g.

min-length enforcement).

Definition at line 42 of file position.h.

Constructor & Destructor Documentation

◆ Position() [1/2]

zrythm::dsp::Position::Position ( QObject * parent = nullptr)
explicit

Construct a Position without a value constraint.

Parameters
parentQObject parent.

◆ Position() [2/2]

zrythm::dsp::Position::Position ( ConstraintFunction constraint,
QObject * parent = nullptr )
explicit

Construct a Position with a value constraint.

Parameters
constraintFunction that clamps/adjusts tick values on setTicks (e.g. min-length enforcement).
parentQObject parent.

Member Function Documentation

◆ addTicks()

Q_INVOKABLE void zrythm::dsp::Position::addTicks ( double ticks)
inline

Definition at line 70 of file position.h.

◆ set_ticks_without_constraint()

void zrythm::dsp::Position::set_ticks_without_constraint ( double ticks)

Set ticks without applying constraint_.

Intended for atomic batch updates by callers that maintain position invariants themselves (e.g. structure::arrangement::Clip::setLoopRange). Still emits positionChanged when the value actually changes.

◆ ticks()

double zrythm::dsp::Position::ticks ( ) const
inline

The stored tick value (meaning depends on owner context).

Definition at line 60 of file position.h.

Property Documentation

◆ ticks

double zrythm::dsp::Position::ticks
readwrite

Definition at line 35 of file position.h.


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