Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
AutomationPoint Class Referencefinal

An automation point inside an AutomationTrack. More...

#include <src/gui/dsp/automation_point.h>

Inheritance diagram for AutomationPoint:
Collaboration diagram for AutomationPoint:

Public Types

using RegionT = AutomationRegion
 
- Public Types inherited from ArrangerObject
enum class  ResizeType {
  Normal , Loop , Fade , Stretch ,
  StretchTempoChange
}
 Flag used in some functions. More...
 
enum class  Type {
  MidiRegion , AudioRegion , ChordRegion , AutomationRegion ,
  MidiNote , ChordObject , ScaleObject , Marker ,
  AutomationPoint
}
 The type of the object. More...
 
enum class  Flags { NonProject = 1 << 0 }
 Flags. More...
 
enum class  PositionType {
  Start , End , ClipStart , LoopStart ,
  LoopEnd , FadeIn , FadeOut
}
 
using SelectionStatusGetter = std::function<bool (const Uuid &)>
 
using Position = zrythm::dsp::Position
 
using ArrangerObjectPtr = ArrangerObject *
 

Public Member Functions

double getValue () const
 
void setValue (double dval)
 
Q_SIGNAL void valueChanged (double)
 
void set_fvalue (float real_val, bool is_normalized)
 Sets the value from given real or normalized value and notifies interested parties.
 
std::string get_fvalue_as_string () const
 String getter for the value.
 
void set_fvalue_with_action (const std::string &fval_str)
 String setter.
 
double get_normalized_value_in_curve (AutomationRegion *region, double x) const
 The function to return a point on the curve.
 
void set_curviness (curviness_t curviness)
 Sets the curviness of the AutomationPoint.
 
ControlPortget_port () const
 Convenience function to return the control port that this AutomationPoint is for.
 
AutomationTrackget_automation_track () const
 Convenience function to return the AutomationTrack that this AutomationPoint is in.
 
bool curves_up () const
 Returns if the curve of the AutomationPoint curves upwards as you move right on the x axis.
 
void init_after_cloning (const AutomationPoint &other, ObjectCloneType clone_type) override
 Initializes the cloned object.
 
ArrangerObjectPtrVariant add_clone_to_project (bool fire_events) const override
 Appends the ArrangerObject to where it belongs in the project (eg, a Track), without taking into account its previous index (eg, before deletion if undoing).
 
ArrangerObjectPtrVariant insert_clone_to_project () const override
 Inserts the object where it belongs in the project (eg, a Track).
 
bool validate (bool is_project, dsp::FramesPerTick frames_per_tick) const override
 Validates the arranger object.
 
- Public Member Functions inherited from RegionOwnedObject
 RegionOwnedObject (ArrangerObjectRegistry &obj_registry) noexcept
 
void set_region_and_index (const Region &region)
 Sets the region the object belongs to and the related index inside it.
 
template<typename SelfT>
void get_global_start_pos (this const SelfT &self, dsp::Position &pos, dsp::FramesPerTick frames_per_tick)
 Gets the global (timeline-based) start Position of the object.
 
template<typename SelfT>
auto get_region (this const SelfT &self)
 If the object is part of a Region, returns it, otherwise returns NULL.
 
- Public Member Functions inherited from ArrangerObject
auto get_type () const
 
virtual utils::Utf8String gen_human_friendly_name () const
 Generates a human readable name for the object.
 
bool is_start_hit_by_range (const dsp::Position &start, const dsp::Position &end, bool range_start_inclusive=true, bool range_end_inclusive=false) const
 Returns whether the given object is hit by the given range.
 
bool is_start_hit_by_range (const signed_frame_t global_frames_start, const signed_frame_t global_frames_end, bool range_start_inclusive=true, bool range_end_inclusive=false) const
 
void set_parent_on_base_qproperties (QObject &derived)
 Set the parent on QObject's that are children of this class.
 
auto get_position () const
 Getter.
 
void position_setter_validated (const dsp::Position &pos, dsp::TicksPerFrame ticks_per_frame)
 The setter is for use in e.g.
 
void set_position_unvalidated (const dsp::Position &pos)
 
bool is_position_valid (const dsp::Position &pos, PositionType pos_type, dsp::TicksPerFrame ticks_per_frame) const
 Returns if the given Position is valid.
 
bool set_position (const dsp::Position &pos, PositionType pos_type, bool validate, dsp::TicksPerFrame ticks_per_frame)
 Sets the given position on the object, optionally attempting to validate before.
 
void move (double ticks, dsp::FramesPerTick frames_per_tick)
 Moves the object by the given amount of ticks.
 
void set_track_id (const TrackUuid &track_id)
 
void set_track_id (std::optional< TrackUuid > track_id)
 
void unset_track_id ()
 
void update_positions (bool from_ticks, bool bpm_change, dsp::FramesPerTick frames_per_tick)
 Updates the positions in each child recursively.
 
auto get_track () const
 Returns the Track this ArrangerObject is in.
 
std::optional< TrackUuidget_track_id () const
 
std::optional< ArrangerObjectPtrVariant > remove_from_project (bool free_obj, bool fire_events=false)
 Removes the object (which can be obtained from find_in_project()) from its parent in the project.
 
void set_selection_status_getter (SelectionStatusGetter getter)
 
void unset_selection_status_getter ()
 
virtual bool is_deletable () const
 Returns whether the given object is deletable or not (eg, start marker).
 
- Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< ArrangerObject >
 UuidIdentifiableObject (const Uuid &id)
 
 UuidIdentifiableObject (const UuidIdentifiableObject &other)=default
 
 UuidIdentifiableObject (UuidIdentifiableObject &&other)=default
 
UuidIdentifiableObjectoperator= (const UuidIdentifiableObject &other)=default
 
UuidIdentifiableObjectoperator= (UuidIdentifiableObject &&other)=default
 
auto get_uuid () const
 
void copy_members_from (const UuidIdentifiableObject &other)
 
- Public Member Functions inherited from ICloneable< AutomationPoint >
std::unique_ptr< AutomationPointclone_unique (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const
 
std::shared_ptr< AutomationPointclone_shared (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const
 
AutomationPointclone_raw_ptr (ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const
 
AutomationPointclone_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const
 
QScopedPointer< AutomationPointclone_unique_qobject (QObject *parent, ObjectCloneType clone_type=ObjectCloneType::Snapshot, Args &&... args) const
 

Data Fields

float fvalue_ = 0.f
 Float value (real).
 
float normalized_val_ = 0.f
 Normalized value (0 to 1) used as a cache.
 
dsp::CurveOptions curve_opts_ {}
 
- Data Fields inherited from RegionOwnedObject
ArrangerObjectRegistryobject_registry_
 
std::optional< ArrangerObject::Uuid > region_id_
 Parent region identifier for objects that are part of a region.
 
- Data Fields inherited from ArrangerObject
Flags flags_ {}
 Track this object belongs to (cache to be set during graph calculation).
 
- Data Fields inherited from ICloneable< AutomationPoint >
friend Derived
 

Properties

QML_ELEMENT double value
 

Friends

bool operator< (const AutomationPoint &a, const AutomationPoint &b)
 
bool operator== (const AutomationPoint &a, const AutomationPoint &b)
 
void to_json (nlohmann::json &j, const AutomationPoint &point)
 
void from_json (const nlohmann::json &j, AutomationPoint &point)
 

Additional Inherited Members

- Static Public Attributes inherited from ArrangerObject
static constexpr double DEFAULT_NUDGE_TICKS = 0.1
 
- Protected Member Functions inherited from RegionOwnedObject
void copy_members_from (const RegionOwnedObject &other, ObjectCloneType clone_type)
 
- Protected Member Functions inherited from ArrangerObject
 ArrangerObject (Type type, TrackResolver track_resolver) noexcept
 
void copy_members_from (const ArrangerObject &other, ObjectCloneType clone_type)
 
bool are_members_valid (bool is_project, dsp::FramesPerTick frames_per_tick) const
 To be called by validate() implementations.
 
- Protected Attributes inherited from ArrangerObject
TrackResolver track_resolver_
 
PositionProxypos_ = nullptr
 Position (or start Position if the object has length).
 
std::optional< TrackUuidtrack_id_
 ID of the track this object belongs to.
 
std::optional< SelectionStatusGetter > selection_status_getter_
 Whether part of an auditioner track.
 

Detailed Description

An automation point inside an AutomationTrack.

Definition at line 31 of file automation_point.h.

Member Typedef Documentation

◆ RegionT

Definition at line 41 of file automation_point.h.

Member Function Documentation

◆ add_clone_to_project()

ArrangerObjectPtrVariant AutomationPoint::add_clone_to_project ( bool fire_events) const
overridevirtual

Appends the ArrangerObject to where it belongs in the project (eg, a Track), without taking into account its previous index (eg, before deletion if undoing).

Exceptions
ZrythmErroron failure.
Returns
A reference to the newly added clone.

Implements ArrangerObject.

◆ get_normalized_value_in_curve()

double AutomationPoint::get_normalized_value_in_curve ( AutomationRegion * region,
double x ) const

The function to return a point on the curve.

See https://stackoverflow.com/questions/17623152/how-map-tween-a-number-based-on-a-dynamic-curve

Parameters
regionregion The automation region (if known), otherwise the non-cached region will be used.
xNormalized x.

◆ getValue()

double AutomationPoint::getValue ( ) const
inline

Definition at line 51 of file automation_point.h.

◆ init_after_cloning()

void AutomationPoint::init_after_cloning ( const AutomationPoint & other,
ObjectCloneType clone_type )
overridevirtual

Initializes the cloned object.

Note
Only final classes should implement this.
Exceptions
ZrythmExceptionIf the object could not be cloned.

Implements ICloneable< AutomationPoint >.

◆ insert_clone_to_project()

ArrangerObjectPtrVariant AutomationPoint::insert_clone_to_project ( ) const
overridevirtual

Inserts the object where it belongs in the project (eg, a Track).

This function assumes that the object already knows the index where it should be inserted in its parent.

This is mostly used when undoing.

Exceptions
ZrythmExceptionon failure.
Returns
A reference to the newly inserted clone.

Implements ArrangerObject.

◆ set_fvalue()

void AutomationPoint::set_fvalue ( float real_val,
bool is_normalized )

Sets the value from given real or normalized value and notifies interested parties.

Parameters
is_normalizedWhether the given value is normalized.

◆ setValue()

void AutomationPoint::setValue ( double dval)
inline

Definition at line 53 of file automation_point.h.

◆ validate()

bool AutomationPoint::validate ( bool is_project,
dsp::FramesPerTick frames_per_tick ) const
overridevirtual

Validates the arranger object.

Parameters
frames_per_tickFrames per tick used when validating audio regions. Passing 0 will use the value from the current engine.
Returns
Whether valid.

Must only be implemented by final objects.

Implements ArrangerObject.

Friends And Related Symbol Documentation

◆ from_json

void from_json ( const nlohmann::json & j,
AutomationPoint & point )
friend

Definition at line 161 of file automation_point.h.

◆ operator<

bool operator< ( const AutomationPoint & a,
const AutomationPoint & b )
friend

Definition at line 128 of file automation_point.h.

◆ operator==

bool operator== ( const AutomationPoint & a,
const AutomationPoint & b )
friend

Definition at line 140 of file automation_point.h.

◆ to_json

void to_json ( nlohmann::json & j,
const AutomationPoint & point )
friend

Definition at line 153 of file automation_point.h.

Field Documentation

◆ curve_opts_

dsp::CurveOptions AutomationPoint::curve_opts_ {}

Definition at line 177 of file automation_point.h.

◆ fvalue_

float AutomationPoint::fvalue_ = 0.f

Float value (real).

Definition at line 172 of file automation_point.h.

◆ normalized_val_

float AutomationPoint::normalized_val_ = 0.f

Normalized value (0 to 1) used as a cache.

Definition at line 175 of file automation_point.h.

Property Documentation

◆ value

QML_ELEMENT double AutomationPoint::value
readwrite

Definition at line 39 of file automation_point.h.


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