Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::structure::tracks::AutomationTrack Class Reference
Inheritance diagram for zrythm::structure::tracks::AutomationTrack:
Collaboration diagram for zrythm::structure::tracks::AutomationTrack:

Public Member Functions

 AutomationTrack (const dsp::TempoMapWrapper &tempo_map, dsp::FileAudioSourceRegistry &file_audio_source_registry, ArrangerObjectRegistry &obj_registry, dsp::ProcessorParameterUuidReference param_id, QObject *parent=nullptr)
 Creates an automation track for the given parameter.
dsp::ProcessorParameterparameter () const
AutomationMode getAutomationMode () const
void setAutomationMode (AutomationMode automation_mode)
Q_SIGNAL void automationModeChanged (AutomationMode automation_mode)
AutomationRecordMode getRecordMode () const
void setRecordMode (AutomationRecordMode record_mode)
Q_INVOKABLE void swapRecordMode ()
Q_SIGNAL void recordModeChanged (AutomationRecordMode record_mode)
Q_INVOKABLE void regeneratePlaybackCaches (utils::ExpandableTickRange affectedRange)
 To be connected to to notify of any changes to the automation content.
Q_SIGNAL void automationObjectsNeedRecache (utils::ExpandableTickRange affectedRange)
 Fired when a new cache is required.
bool should_read_automation () const
 Returns whether the automation in the automation track should be read.
bool should_be_recording (bool record_aps) const
 Returns if the automation track should currently be recording data.
AutomationPoint * get_automation_point_around (units::precise_tick_t position_ticks, units::precise_tick_t delta_ticks, bool search_only_backwards=false)
 Find an automation point near the given position position_ticks with a tolerance of delta_ticks.
AutomationPoint * get_automation_point_before (units::sample_t timeline_position, bool search_only_regions_enclosing_position) const
 Returns the last automation point before the given timeline position.
auto get_region_before (units::sample_t pos_samples, bool search_only_regions_enclosing_position) const -> AutomationRegion *
 Returns the active region at a given position, if any.
std::optional< float > get_normalized_value (units::sample_t timeline_frames, bool search_only_regions_enclosing_position) const
 Returns the normalized parameter value at the given timeline position.
bool contains_automation () const
std::string get_field_name_for_serialization (const AutomationRegion *) const override
Public Member Functions inherited from zrythm::structure::arrangement::ArrangerObjectOwner< arrangement::AutomationRegion >
 ArrangerObjectOwner (ArrangerObjectRegistry &registry, dsp::FileAudioSourceRegistry &file_audio_source_registry, T &derived)
auto & get_children_vector () const
auto get_children_view () const
auto get_sorted_children_view () const
void add_ticks_to_children (double ticks)
bool contains_object (const ArrangerObject::Uuid &id) const
 O(1) lookup if an object with the given ID exists.
ArrangerObjectListModel * get_model () const
ArrangerObjectUuidReference remove_object (this SelfT &self, const ArrangerObject::Uuid &id)
void insert_object (this SelfT &self, const ArrangerObjectUuidReference &obj_ref, int idx)
void add_object (this SelfT &self, const ArrangerObjectUuidReference &obj_ref)
void clear_objects ()
virtual std::string get_field_name_for_serialization (const ChildT *) const=0
 Get the children field name to be used during serialization/deserialization.

Static Public Attributes

static constexpr auto kParamIdKey = "paramId"sv

Properties

QML_ELEMENT dsp::ProcessorParameterparameter
AutomationMode automationMode
AutomationRecordMode recordMode

Friends

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

Additional Inherited Members

Public Types inherited from zrythm::structure::arrangement::ArrangerObjectOwner< arrangement::AutomationRegion >
using ArrangerObjectChildType
using ArrangerObjectListModel

Detailed Description

Definition at line 21 of file automation_track.h.

Member Function Documentation

◆ contains_automation()

bool zrythm::structure::tracks::AutomationTrack::contains_automation ( ) const
inline

Definition at line 183 of file automation_track.h.

◆ get_automation_point_around()

AutomationPoint * zrythm::structure::tracks::AutomationTrack::get_automation_point_around ( units::precise_tick_t position_ticks,
units::precise_tick_t delta_ticks,
bool search_only_backwards = false )

Find an automation point near the given position position_ticks with a tolerance of delta_ticks.

This is used eg, in the UI to check if we should select an existing automation point on user click, or whether to create a new automation point.

Parameters
search_only_backwardsOnly check previous automation points.

◆ get_automation_point_before()

AutomationPoint * zrythm::structure::tracks::AutomationTrack::get_automation_point_before ( units::sample_t timeline_position,
bool search_only_regions_enclosing_position ) const

Returns the last automation point before the given timeline position.

This first finds the relevant automation regio nusing get_region_before(), then finds the last point located before the position (converted to region-local coordinates).

See also
get_region_before().

◆ get_field_name_for_serialization()

std::string zrythm::structure::tracks::AutomationTrack::get_field_name_for_serialization ( const AutomationRegion * ) const
inlineoverride

Definition at line 186 of file automation_track.h.

◆ get_normalized_value()

std::optional< float > zrythm::structure::tracks::AutomationTrack::get_normalized_value ( units::sample_t timeline_frames,
bool search_only_regions_enclosing_position ) const

Returns the normalized parameter value at the given timeline position.

Parameters
search_only_regions_enclosing_position
See also
get_region_before().
Returns
The normalized parameter value, or std::nullopt if there is no automation point/curve at the position.

◆ get_region_before()

auto zrythm::structure::tracks::AutomationTrack::get_region_before ( units::sample_t pos_samples,
bool search_only_regions_enclosing_position ) const->AutomationRegion *

Returns the active region at a given position, if any.

Parameters
search_only_regions_enclosing_positionWhether to only check in regions that span the given position. If this is false, positions that end before the position are also considered. When this is true and multiple regions exist that meet the requirements, the behavior is not defined - any region could be picked.

◆ getAutomationMode()

AutomationMode zrythm::structure::tracks::AutomationTrack::getAutomationMode ( ) const
inline

Definition at line 78 of file automation_track.h.

◆ getRecordMode()

AutomationRecordMode zrythm::structure::tracks::AutomationTrack::getRecordMode ( ) const
inline

Definition at line 82 of file automation_track.h.

◆ parameter()

dsp::ProcessorParameter * zrythm::structure::tracks::AutomationTrack::parameter ( ) const
inline

Definition at line 73 of file automation_track.h.

◆ regeneratePlaybackCaches()

Q_INVOKABLE void zrythm::structure::tracks::AutomationTrack::regeneratePlaybackCaches ( utils::ExpandableTickRange affectedRange)

To be connected to to notify of any changes to the automation content.

This will request new caches to be generated.

◆ should_be_recording()

bool zrythm::structure::tracks::AutomationTrack::should_be_recording ( bool record_aps) const

Returns if the automation track should currently be recording data.

Returns false if in touch mode after the release time has passed.

This function assumes that the transport will be rolling.

Parameters
record_apsIf set to true, this function will return whether we should be recording automation point data. If set to false, this function will return whether we should be recording a region (eg, if an automation point was already created before and we are still recording inside a region regardless of whether we should create/edit automation points or not.

◆ swapRecordMode()

Q_INVOKABLE void zrythm::structure::tracks::AutomationTrack::swapRecordMode ( )
inline

Definition at line 84 of file automation_track.h.

Field Documentation

◆ kParamIdKey

auto zrythm::structure::tracks::AutomationTrack::kParamIdKey = "paramId"sv
staticconstexpr

Definition at line 192 of file automation_track.h.

Property Documentation

◆ automationMode

AutomationMode zrythm::structure::tracks::AutomationTrack::automationMode
readwrite

Definition at line 28 of file automation_track.h.

◆ parameter

QML_ELEMENT dsp::ProcessorParameter * zrythm::structure::tracks::AutomationTrack::parameter
read

Definition at line 27 of file automation_track.h.

◆ recordMode

AutomationRecordMode zrythm::structure::tracks::AutomationTrack::recordMode
readwrite

Definition at line 29 of file automation_track.h.


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