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

Interface for a track that has automatable parameters. More...

#include <src/structure/tracks/automatable_track.h>

Inheritance diagram for zrythm::structure::tracks::AutomatableTrack:
Collaboration diagram for zrythm::structure::tracks::AutomatableTrack:

Public Types

using Plugin = gui::old_dsp::plugins::Plugin
using PluginRegistry = gui::old_dsp::plugins::PluginRegistry
Public Types inherited from zrythm::structure::tracks::Track
using PluginUuid = gui::old_dsp::plugins::Plugin::Uuid
using PortType = dsp::PortType
using PluginRegistry = gui::old_dsp::plugins::PluginRegistry
using PluginPtrVariant = PluginRegistry::VariantType
using PluginSlot = plugins::PluginSlot
using ArrangerObject = structure::arrangement::ArrangerObject
using ArrangerObjectPtrVariant
using ArrangerObjectRegistry = structure::arrangement::ArrangerObjectRegistry
using Type = ::TrackTypeWrapper::TrackType
using TrackSelectionStatusGetter = std::function<bool (const Track::Uuid &)>
using Color = utils::Color
using Position = dsp::Position

Public Member Functions

 AutomatableTrack (dsp::FileAudioSourceRegistry &file_audio_source_registry, dsp::PortRegistry &port_registry, dsp::ProcessorParameterRegistry &param_registry, bool new_identity)
void init_loaded (PluginRegistry &plugin_registry, dsp::PortRegistry &port_registry, dsp::ProcessorParameterRegistry &param_registry) override
 Adds additional metadata to track members after deserialization.
AutomationTracklistget_automation_tracklist () const
void set_automation_visible (bool visible)
 Set automation visible and fire events.
void generate_automation_tracks ()
 Generates automatables for the track.
void clear_objects () override
 Removes all objects recursively from the track.
void get_regions_in_range (std::vector< arrangement::ArrangerObjectUuidReference > &regions, std::optional< signed_frame_t > p1, std::optional< signed_frame_t > p2) override
 Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, AutomatableTrack> && FinalClass<base_type<DerivedT>>
std::optional< PluginPtrVariant > get_plugin_at_slot (this DerivedT &&self, PluginSlot slot)
 Returns the plugin at the given slot, if any.
void generate_automation_tracks_for_plugin (const Plugin::Uuid &plugin_id)
 Generates automatables for the plugin.
Public Member Functions inherited from zrythm::structure::tracks::Track
Tracklistget_tracklist () const
dsp::PortConnectionsManagerget_port_connections_manager () const
bool has_piano_roll () const
bool should_be_visible () const
 Returns whether the track should be visible.
bool is_folder () const
bool is_audio_group () const
bool is_midi_group () const
bool is_audio_bus () const
bool is_midi_bus () const
bool is_modulator () const
bool is_chord () const
bool is_marker () const
bool is_audio () const
bool is_instrument () const
bool is_midi () const
bool is_master () const
bool is_deletable () const
bool is_copyable () const
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
double get_full_visible_height (this DerivedT &&self)
 Returns the full visible height (main height + height of all visible automation tracks + height of all visible lanes).
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
bool multiply_heights (this DerivedT &&self, double multiplier, bool visible_only, bool check_only)
bool is_auditioner () const
 Whether this track is part of the SampleProcessor auditioner tracklist.
bool can_be_group_target () const
bool is_frozen () const
template<arrangement::RegionObject RegionT, FinalClass SelfT>
void insert_region (this SelfT &self, arrangement::ArrangerObjectUuidReference region_ref, AutomationTrack *at, std::optional< int > lane_pos, std::optional< int > idx, bool gen_name)
 Inserts a Region to the given lane or AutomationTrack of the track, at the given index.
template<arrangement::RegionObject RegionT>
void add_region (this auto &self, auto region_ref, AutomationTrack *at, std::optional< int > lane_pos, bool gen_name)
 Appends a Region to the given lane or AutomationTrack of the track.
void append_objects (std::vector< ArrangerObjectPtrVariant > &objects) const
 Appends all the objects in the track to objects.
void unselect_all ()
 Unselects all arranger objects in the track.
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
bool contains_uninstantiated_plugin (this DerivedT &&self)
virtual void temporary_virtual_method_hack () const =0
void add_folder_parents (std::vector< FoldableTrack * > &parents, bool prepend) const
 Adds the track's folder parents to the given vector.
FoldableTrackget_direct_folder_parent () const
 Returns the closest foldable parent or NULL.
void remove_from_folder_parents ()
 Remove the track from all folders.
utils::Utf8String get_name () const
 Getter for the track name.
bool set_name_with_action_full (const utils::Utf8String &name)
 Internally called by set_name_with_action().
void set_name_with_action (const utils::Utf8String &name)
 Setter to be used by the UI to create an undoable action.
void set_name (const Tracklist &tracklist, const utils::Utf8String &name, bool pub_events)
 Setter for the track name.
utils::Utf8String get_unique_name (const Tracklist &tracklist, const utils::Utf8String &name)
 Returns a unique name for a new track based on the given name.
int get_index () const
void set_index (int index)
auto get_input_signal_type () const
auto get_output_signal_type () const
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
void get_plugins (this DerivedT &&self, std::vector< zrythm::gui::old_dsp::plugins::Plugin * > &arr)
 Fills in the given array with all plugins in the track.
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
void activate_all_plugins (this DerivedT &&self, bool activate)
 Activate or deactivate all plugins.
utils::Utf8String get_comment () const
void set_comment (const utils::Utf8String &comment, bool undoable)
void set_comment_with_action (const utils::Utf8String &comment)
void set_color (const Color &color, bool undoable, bool fire_events)
 Sets the track color.
void set_icon (const utils::Utf8String &icon_name, bool undoable, bool fire_events)
 Sets the track icon.
void track_freeze (bool freeze)
 Freezes or unfreezes the track.
template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
PluginPtrVariant insert_plugin (this DerivedT &&self, PluginUuid plugin_id, plugins::PluginSlot slot, bool instantiate_plugin, bool replacing_plugin, bool moving_plugin, bool confirm, bool gen_automatables, bool recalc_graph, bool fire_events)
 Wrapper over Channel.add_plugin() and ModulatorTrack.insert_modulator().
template<typename SelfT>
requires ( std::derived_from<SelfT, ChannelTrack> || std::is_same_v<SelfT, ModulatorTrack>)
void remove_plugin (this SelfT &self, plugins::PluginSlot slot, bool moving_plugin=false, bool deleting_plugin=true)
 Removes a plugin at the given slot from the track.
template<typename SelfT>
requires ( std::derived_from<SelfT, ChannelTrack> || std::is_same_v<SelfT, ModulatorTrack>)
plugins::PluginSlot get_plugin_slot (this const SelfT &self, const PluginUuid &plugin_id)
bool is_enabled () const
bool enabled () const
bool disabled () const
void set_enabled (bool enabled)
void set_enabled (bool enabled, bool trigger_undo, bool auto_select, bool fire_events)
int get_total_bars (const engine::session::Transport &transport, int total_bars) const
void set_caches (CacheType types)
 Set various caches (snapshots, track name hash, plugin input/output ports, etc).
utils::Utf8String get_full_designation_for_port (const dsp::Port &port) const
virtual bool currently_muted () const
virtual bool currently_listened () const
virtual bool get_implied_soloed () const
 Returns whether the track is not soloed on its own but its direct out (or its direct out's direct out, etc.) is soloed.
virtual bool currently_soloed () const
void set_selection_status_getter (TrackSelectionStatusGetter getter)
void unset_selection_status_getter ()
auto & get_plugin_registry () const
auto & get_plugin_registry ()
auto & get_port_registry () const
auto & get_port_registry ()
auto & get_param_registry () const
auto & get_param_registry ()
auto & get_object_registry () const
auto & get_object_registry ()
auto get_type () const
auto get_icon_name () const
Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Track >
UuidIdentifiableObjectoperator= (const UuidIdentifiableObject &other)=default
auto get_uuid () const

Data Fields

utils::QObjectUniquePtr< AutomationTracklistautomation_tracklist_
bool automation_visible_ = false
 Flag to set automations visible or not.
Data Fields inherited from zrythm::structure::tracks::Track
bool bounce_ {}
 Set to ON during bouncing if this track should be included.
bool bounce_to_master_ = false
 Whether to temporarily route the output to master (e.g., when bouncing the track on its own without its parents).
bool disconnecting_ = false
 Whether currently disconnecting.
std::optional< dsp::FileAudioSourceUuidReferencefrozen_clip_id_
 Pool ID of the clip if track is frozen (unset if not frozen).
Tracklisttracklist_ = nullptr
 Pointer to owner tracklist, if any.
std::optional< TrackSelectionStatusGetter > track_selection_status_getter_
 Track selection status getter.

Protected Member Functions

void set_playback_caches () override
 Set the playback caches for a track.
Protected Member Functions inherited from zrythm::structure::tracks::Track
 Track (Type type, PortType in_signal_type, PortType out_signal_type, PluginRegistry &plugin_registry, dsp::PortRegistry &port_registry, dsp::ProcessorParameterRegistry &param_registry, ArrangerObjectRegistry &obj_registry)
 Constructor to be used by subclasses.
void add_region_if_in_range (std::optional< signed_frame_t > p1, std::optional< signed_frame_t > p2, std::vector< arrangement::ArrangerObjectUuidReference > &regions, arrangement::ArrangerObjectUuidReference region)

Friends

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

Additional Inherited Members

Static Public Member Functions inherited from zrythm::structure::tracks::Track
static Fader::Type type_get_fader_type (const Type type)
 Returns the prefader type.
static constexpr bool type_can_have_direct_out (Type type)
static bool type_can_have_region_type (Type type, ArrangerObject::Type region_type)
static constexpr bool type_is_copyable (Type type)
static constexpr bool type_is_deletable (Type type)
 Returns whether a track of the given type should be deletable by the user.
static Type type_get_from_plugin_descriptor (const zrythm::plugins::PluginDescriptor &descr)
static consteval bool type_has_mono_compat_switch (const Type tt)
static constexpr bool type_is_compatible_for_moving (const Type type1, const Type type2)
 Returns if regions in tracks from type1 can be moved to type2.
static constexpr bool type_has_piano_roll (const Type type)
 Returns if the Track should have a piano roll.
static constexpr bool type_has_inputs (const Type type)
 Returns if the Track should have an inputs selector.
static bool type_can_be_group_target (const Type type)
 Returns if the Track can be a direct route target.
template<typename T>
static consteval Type get_type_for_class ()
static Trackfrom_variant (const TrackPtrVariant &variant)
static bool is_plugin_descriptor_valid_for_slot_type (const plugins::PluginDescriptor &descr, zrythm::plugins::PluginSlotType slot_type, Track::Type track_type)
 Returns if descr can be dropped at slot_type in a track of type track_type.
static void create_with_action (Type type, const zrythm::plugins::PluginConfiguration *pl_setting, const FileDescriptor *file_descr, const dsp::Position *pos, int index, int num_tracks, int disable_track_idx, TracksReadyCallback ready_cb)
 Creates a new track with the given parameters.
static Trackcreate_empty_at_idx_with_action (Type type, int index)
 Creates a new empty track at the given index.
static Trackcreate_for_plugin_at_idx_w_action (Type type, const zrythm::plugins::PluginConfiguration *pl_setting, int index)
 Creates a new track for the given plugin at the given index.
template<typename T = Track>
static T * create_for_plugin_at_idx_w_action (const zrythm::plugins::PluginConfiguration *pl_setting, int index)
static Trackcreate_empty_with_action (Type type)
 Creates a new empty track at the end of the tracklist.
template<typename T = Track>
static T * create_empty_with_action ()
Static Public Attributes inherited from zrythm::structure::tracks::Track
static constexpr int MIN_HEIGHT = 26
static constexpr int DEF_HEIGHT = 52
Protected Attributes inherited from zrythm::structure::tracks::Track
PluginRegistryplugin_registry_
dsp::PortRegistryport_registry_
dsp::ProcessorParameterRegistryparam_registry_
arrangement::ArrangerObjectRegistryobject_registry_
int pos_ = 0
 Position in the Tracklist.
Type type_ = {}
 The type of track this is.
utils::Utf8String name_
 Track name, used in channel too.
utils::Utf8String icon_name_
 Icon name of the track.
bool visible_ = true
 Track Widget created dynamically.
bool filtered_ = false
 Track will be hidden if true (temporary and not serializable).
double main_height_ { DEF_HEIGHT }
 Height of the main part (without lanes).
bool enabled_ = true
 Active (enabled) or not.
Color color_
 Track color.
PortType in_signal_type_ = {}
 The input signal type (eg audio bus tracks have audio input signals).
PortType out_signal_type_ = {}
 The output signal type (eg midi tracks have MIDI output signals).
utils::Utf8String comment_
 User comments.

Detailed Description

Interface for a track that has automatable parameters.

Tracks that can have plugins must implement this interface.

Definition at line 47 of file automatable_track.h.

Member Typedef Documentation

◆ Plugin

◆ PluginRegistry

Member Function Documentation

◆ clear_objects()

void zrythm::structure::tracks::AutomatableTrack::clear_objects ( )
inlineoverridevirtual

Removes all objects recursively from the track.

Reimplemented from zrythm::structure::tracks::Track.

Reimplemented in zrythm::structure::tracks::ChordTrack, and zrythm::structure::tracks::PianoRollTrack.

Definition at line 83 of file automatable_track.h.

◆ generate_automation_tracks()

void zrythm::structure::tracks::AutomatableTrack::generate_automation_tracks ( )

Generates automatables for the track.

Should be called as soon as the track is created.

◆ generate_automation_tracks_for_plugin()

void zrythm::structure::tracks::AutomatableTrack::generate_automation_tracks_for_plugin ( const Plugin::Uuid & plugin_id)

Generates automatables for the plugin.

Note
The plugin must be instantiated already.

◆ get_automation_tracklist()

AutomationTracklist & zrythm::structure::tracks::AutomatableTrack::get_automation_tracklist ( ) const
inline

Definition at line 66 of file automatable_track.h.

◆ get_plugin_at_slot()

template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, AutomatableTrack> && FinalClass<base_type<DerivedT>>
std::optional< PluginPtrVariant > zrythm::structure::tracks::AutomatableTrack::get_plugin_at_slot ( this DerivedT && self,
PluginSlot slot )
inline

Returns the plugin at the given slot, if any.

Definition at line 105 of file automatable_track.h.

◆ get_regions_in_range()

void zrythm::structure::tracks::AutomatableTrack::get_regions_in_range ( std::vector< arrangement::ArrangerObjectUuidReference > & regions,
std::optional< signed_frame_t > p1,
std::optional< signed_frame_t > p2 )
inlineoverridevirtual

Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.

Returns
The number of regions returned.

Reimplemented from zrythm::structure::tracks::Track.

Reimplemented in zrythm::structure::tracks::ChordTrack, and zrythm::structure::tracks::PianoRollTrack.

Definition at line 85 of file automatable_track.h.

◆ init_loaded()

◆ set_playback_caches()

void zrythm::structure::tracks::AutomatableTrack::set_playback_caches ( )
inlineoverrideprotectedvirtual

Set the playback caches for a track.

This is called by set_caches().

Reimplemented from zrythm::structure::tracks::Track.

Reimplemented in zrythm::structure::tracks::PianoRollTrack.

Definition at line 142 of file automatable_track.h.

◆ from_json

void from_json ( const nlohmann::json & j,
AutomatableTrack & track )
friend

Definition at line 155 of file automatable_track.h.

◆ to_json

void to_json ( nlohmann::json & j,
const AutomatableTrack & track )
friend

Definition at line 150 of file automatable_track.h.

Field Documentation

◆ automation_tracklist_

utils::QObjectUniquePtr<AutomationTracklist> zrythm::structure::tracks::AutomatableTrack::automation_tracklist_

Definition at line 169 of file automatable_track.h.

◆ automation_visible_

bool zrythm::structure::tracks::AutomatableTrack::automation_visible_ = false

Flag to set automations visible or not.

Definition at line 172 of file automatable_track.h.


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