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

Represents a track in the project. More...

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

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

Public Types

enum class  Type {
  Instrument , Audio , Master , Chord ,
  Marker , Modulator , AudioBus , AudioGroup ,
  Midi , MidiBus , MidiGroup , Folder
}
 The Track's type. More...
 
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 Region = structure::arrangement::Region
 
using TrackSelectionStatusGetter = std::function<bool (const TrackUuid &)>
 
using Color = zrythm::utils::Color
 
using Position = zrythm::dsp::Position
 
- Public Types inherited from IPortOwner
using TrackUuid = dsp::PortIdentifier::TrackUuid
 
using PluginUuid = dsp::PortIdentifier::PluginUuid
 
using PortUuid = dsp::PortIdentifier::PortUuid
 

Public Member Functions

virtual void init_loaded (PluginRegistry &plugin_registry, PortRegistry &port_registry)=0
 Adds additional metadata to track members after deserialization.
 
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::FinalRegionSubclass 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.
 
void write_audio_clip_to_pool_after_adding_audio_region (AudioClip &clip) const
 
template<arrangement::FinalRegionSubclass 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)
 
utils::Utf8String get_node_name () const override
 Returns a human friendly name of the node.
 
virtual void clear_objects ()
 Removes all objects recursively from the track.
 
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.
 
void update_positions (bool from_ticks, bool bpm_change, dsp::FramesPerTick frames_per_tick)
 Updates the frames/ticks of each position in each child of the track recursively.
 
virtual void get_regions_in_range (std::vector< Region * > &regions, const dsp::Position *p1, const dsp::Position *p2)
 Returns all the regions inside the given range, or all the regions if both p1 and p2 are NULL.
 
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.
 
virtual void append_ports (std::vector< Port * > &ports, bool include_plugins) const =0
 Appends all channel ports and optionally plugin ports to the array.
 
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 get_enabled () const
 
bool get_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).
 
void set_port_metadata_from_owner (dsp::PortIdentifier &id, PortRange &range) const override
 Function that will be called by the Port to update the identifier's relevant members based on this port owner.
 
utils::Utf8String get_full_designation_for_port (const dsp::PortIdentifier &id) const override
 
virtual bool get_muted () const
 
virtual bool get_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 get_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_object_registry () const
 
auto & get_object_registry ()
 
auto get_type () const
 
auto get_icon_name () const
 
- Public Member Functions inherited from zrythm::dsp::graph::IProcessable
virtual nframes_t get_single_playback_latency () const
 Returns the latency of only the given processable, without adding the previous/next latencies.
 
virtual void prepare_for_processing (sample_rate_t sample_rate, nframes_t max_block_length)
 Called to allocate resources required for processing.
 
virtual void process_block (EngineProcessTimeInfo time_nfo)
 
virtual void release_resources ()
 Called to release resources allocated by prepare_for_processing().
 
- Public Member Functions inherited from IPortOwner
virtual void on_control_change_event (const PortUuid &port_uuid, const dsp::PortIdentifier &id, float val)
 Will be called when a control port's value changes.
 
virtual void on_midi_activity (const dsp::PortIdentifier &id)
 Called during processing if the MIDI port contains new MIDI events.
 
virtual bool should_sum_data_from_backend () const
 Whether during processing, the port should sum the data from its backend buffers coming in.
 
virtual bool should_bounce_to_master (utils::audio::BounceStep step) const
 Whether the port should add its data to the master output when bouncing.
 
virtual bool are_events_on_midi_channel_approved (midi_byte_t channel) const
 Returns whether MIDI events on this channel on an input port should be processed (not ignored).
 
- Public Member Functions inherited from zrythm::utils::UuidIdentifiableObject< Track >
 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
 

Static Public Member Functions

static Fader::Type type_get_prefader_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 TrackUniquePtrVariant create_track (Type type, const utils::Utf8String &name, int pos)
 Create a track of the given type with the given name and position.
 

Data Fields

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.
 
bool trigger_midi_activity_ = false
 Flag to tell the UI that this channel had MIDI activity.
 
std::optional< AudioClip::Uuid > frozen_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.
 

Static Public Attributes

static constexpr int MIN_HEIGHT = 26
 
static constexpr int DEF_HEIGHT = 52
 

Protected Member Functions

 Track (Type type, PortType in_signal_type, PortType out_signal_type, PluginRegistry &plugin_registry, PortRegistry &port_registry, ArrangerObjectRegistry &obj_registry)
 Constructor to be used by subclasses.
 
virtual void set_playback_caches ()
 Set the playback caches for a track.
 
void add_region_if_in_range (const dsp::Position *p1, const dsp::Position *p2, std::vector< Region * > &regions, Region *region)
 

Protected Attributes

PluginRegistryplugin_registry_
 
PortRegistryport_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.
 

Friends

class Tracklist
 
bool operator< (const Track &lhs, const Track &rhs)
 
void init_from (Track &obj, const Track &other, utils::ObjectCloneType clone_type)
 
void to_json (nlohmann::json &j, const Track &track)
 
void from_json (const nlohmann::json &j, Track &track)
 

Detailed Description

Represents a track in the project.

The Track class is the base class for all types of tracks in the project. It provides common functionality and properties shared by all track types, such as the track's position in the tracklist, its label, and whether it is muted.

Subclasses of Track represent specific types of tracks, such as MIDI tracks, instrument tracks, and audio tracks.

Definition at line 272 of file track.h.

Member Typedef Documentation

◆ ArrangerObject

◆ ArrangerObjectPtrVariant

using zrythm::structure::tracks::Track::ArrangerObjectPtrVariant
Initial value:
structure::arrangement::ArrangerObjectPtrVariant

Definition at line 283 of file track.h.

◆ ArrangerObjectRegistry

◆ Color

◆ PluginPtrVariant

using zrythm::structure::tracks::Track::PluginPtrVariant = PluginRegistry::VariantType

Definition at line 280 of file track.h.

◆ PluginRegistry

◆ PluginSlot

◆ PortType

using zrythm::structure::tracks::Track::PortType = dsp::PortType

Definition at line 278 of file track.h.

◆ Position

◆ Region

◆ TrackSelectionStatusGetter

using zrythm::structure::tracks::Track::TrackSelectionStatusGetter = std::function<bool (const TrackUuid &)>

Definition at line 288 of file track.h.

Member Enumeration Documentation

◆ Type

The Track's type.

Enumerator
Instrument 

Instrument tracks must have an Instrument plugin at the first slot and they produce audio output.

Audio 

Audio tracks can record and contain audio clips.

Other than that their channel strips are similar to buses.

Master 

The master track is a special type of group track.

Chord 

The chord track contains chords that can be used to modify midi in real time or to color the piano roll.

Marker 

Marker Track's contain named markers at specific Position's in the song.

Modulator 

Special track to contain global Modulator's.

AudioBus 

Buses are channels that receive audio input and have effects on their channel strip.

They are similar to Group Tracks, except that they cannot be routed to directly. Buses are used for send effects.

AudioGroup 

Group Tracks are used for grouping audio signals, for example routing multiple drum tracks to a "Drums" group track.

Like buses, they only contain effects but unlike buses they can be routed to.

Midi 

Midi tracks can only have MIDI effects in the strip and produce MIDI output that can be routed to instrument channels or hardware.

MidiBus 

Same with audio bus but for MIDI signals.

MidiGroup 

Same with audio group but for MIDI signals.

Folder 

Foldable track used for visual grouping.

Definition at line 298 of file track.h.

Constructor & Destructor Documentation

◆ Track()

zrythm::structure::tracks::Track::Track ( Type type,
PortType in_signal_type,
PortType out_signal_type,
PluginRegistry & plugin_registry,
PortRegistry & port_registry,
ArrangerObjectRegistry & obj_registry )
protected

Constructor to be used by subclasses.

Parameters
posPosition in the Tracklist.

Member Function Documentation

◆ activate_all_plugins()

template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
void zrythm::structure::tracks::Track::activate_all_plugins ( this DerivedT && self,
bool activate )
inline

Activate or deactivate all plugins.

This is useful for exporting: deactivating and reactivating a plugin will reset its state.

Definition at line 966 of file track.h.

◆ add_folder_parents()

void zrythm::structure::tracks::Track::add_folder_parents ( std::vector< FoldableTrack * > & parents,
bool prepend ) const

Adds the track's folder parents to the given vector.

Parameters
prependWhether to prepend instead of append.

◆ add_region()

template<arrangement::FinalRegionSubclass RegionT>
void zrythm::structure::tracks::Track::add_region ( this auto & self,
auto region_ref,
AutomationTrack * at,
std::optional< int > lane_pos,
bool gen_name )
inline

Appends a Region to the given lane or AutomationTrack of the track.

See also
insert_region().
Exceptions
ZrythmExceptionif the insertion fails.

Definition at line 790 of file track.h.

◆ append_objects()

void zrythm::structure::tracks::Track::append_objects ( std::vector< ArrangerObjectPtrVariant > & objects) const

Appends all the objects in the track to objects.

This only appends top-level objects. For example, region children will not be added.

Parameters
objects

◆ append_ports()

◆ can_be_group_target()

bool zrythm::structure::tracks::Track::can_be_group_target ( ) const
inline

Definition at line 668 of file track.h.

◆ clear_objects()

◆ contains_uninstantiated_plugin()

template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
bool zrythm::structure::tracks::Track::contains_uninstantiated_plugin ( this DerivedT && self)
inline

Definition at line 817 of file track.h.

◆ create_empty_at_idx_with_action()

static Track * zrythm::structure::tracks::Track::create_empty_at_idx_with_action ( Type type,
int index )
static

Creates a new empty track at the given index.

Parameters
type
index
error
Returns
Track*
Exceptions
ZrythmExceptionon error.

◆ create_empty_with_action() [1/2]

template<typename T = Track>
static T * zrythm::structure::tracks::Track::create_empty_with_action ( )
inlinestatic

Definition at line 1325 of file track.h.

◆ create_empty_with_action() [2/2]

static Track * zrythm::structure::tracks::Track::create_empty_with_action ( Type type)
static

Creates a new empty track at the end of the tracklist.

Parameters
type
Returns
Track*
Exceptions
ZrythmExceptionon error.

◆ create_for_plugin_at_idx_w_action() [1/2]

template<typename T = Track>
static T * zrythm::structure::tracks::Track::create_for_plugin_at_idx_w_action ( const zrythm::plugins::PluginConfiguration * pl_setting,
int index )
inlinestatic

Definition at line 1308 of file track.h.

◆ create_for_plugin_at_idx_w_action() [2/2]

static Track * zrythm::structure::tracks::Track::create_for_plugin_at_idx_w_action ( Type type,
const zrythm::plugins::PluginConfiguration * pl_setting,
int index )
static

Creates a new track for the given plugin at the given index.

Parameters
type
pl_setting
index
error
Returns
Track*
Exceptions
ZrythmExceptionon error.

◆ create_track()

static TrackUniquePtrVariant zrythm::structure::tracks::Track::create_track ( Type type,
const utils::Utf8String & name,
int pos )
staticnodiscard

Create a track of the given type with the given name and position.

Note
Only works for non-singleton tracks.
Parameters
name
pos

◆ create_with_action()

static void zrythm::structure::tracks::Track::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 )
static

Creates a new track with the given parameters.

Parameters
disable_track_idxTrack index to disable, or -1.
ready_cbCallback to be called when the tracks are ready (added to the project).
Exceptions
ZrythmExceptionon error.

◆ get_comment()

utils::Utf8String zrythm::structure::tracks::Track::get_comment ( ) const
inline

Definition at line 994 of file track.h.

◆ get_direct_folder_parent()

FoldableTrack * zrythm::structure::tracks::Track::get_direct_folder_parent ( ) const
inline

Returns the closest foldable parent or NULL.

Definition at line 846 of file track.h.

◆ get_disabled()

bool zrythm::structure::tracks::Track::get_disabled ( ) const
inline

Definition at line 1243 of file track.h.

◆ get_enabled()

bool zrythm::structure::tracks::Track::get_enabled ( ) const
inline

Definition at line 1242 of file track.h.

◆ get_full_designation_for_port()

utils::Utf8String zrythm::structure::tracks::Track::get_full_designation_for_port ( const dsp::PortIdentifier & id) const
overridevirtual

Reimplemented from IPortOwner.

◆ get_full_visible_height()

template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
double zrythm::structure::tracks::Track::get_full_visible_height ( this DerivedT && self)
inline

Returns the full visible height (main height + height of all visible automation tracks + height of all visible lanes).

Definition at line 576 of file track.h.

◆ get_icon_name()

auto zrythm::structure::tracks::Track::get_icon_name ( ) const
inline

Definition at line 1378 of file track.h.

◆ get_implied_soloed()

virtual bool zrythm::structure::tracks::Track::get_implied_soloed ( ) const
inlinevirtual

Returns whether the track is not soloed on its own but its direct out (or its direct out's direct out, etc.) is soloed.

Reimplemented in zrythm::structure::tracks::ChannelTrack, and zrythm::structure::tracks::FolderTrack.

Definition at line 1357 of file track.h.

◆ get_index()

int zrythm::structure::tracks::Track::get_index ( ) const
inline

Definition at line 926 of file track.h.

◆ get_input_signal_type()

auto zrythm::structure::tracks::Track::get_input_signal_type ( ) const
inline

Definition at line 929 of file track.h.

◆ get_listened()

virtual bool zrythm::structure::tracks::Track::get_listened ( ) const
inlinevirtual

Reimplemented in zrythm::structure::tracks::ChannelTrack.

Definition at line 1351 of file track.h.

◆ get_muted()

virtual bool zrythm::structure::tracks::Track::get_muted ( ) const
inlinevirtual

Reimplemented in zrythm::structure::tracks::ChannelTrack.

Definition at line 1349 of file track.h.

◆ get_name()

utils::Utf8String zrythm::structure::tracks::Track::get_name ( ) const
inline

Getter for the track name.

Definition at line 867 of file track.h.

◆ get_node_name()

utils::Utf8String zrythm::structure::tracks::Track::get_node_name ( ) const
inlineoverridevirtual

Returns a human friendly name of the node.

Implements zrythm::dsp::graph::IProcessable.

Definition at line 828 of file track.h.

◆ get_object_registry() [1/2]

auto & zrythm::structure::tracks::Track::get_object_registry ( )
inline

Definition at line 1375 of file track.h.

◆ get_object_registry() [2/2]

auto & zrythm::structure::tracks::Track::get_object_registry ( ) const
inline

Definition at line 1374 of file track.h.

◆ get_output_signal_type()

auto zrythm::structure::tracks::Track::get_output_signal_type ( ) const
inline

Definition at line 930 of file track.h.

◆ get_plugin_registry() [1/2]

auto & zrythm::structure::tracks::Track::get_plugin_registry ( )
inline

Definition at line 1371 of file track.h.

◆ get_plugin_registry() [2/2]

auto & zrythm::structure::tracks::Track::get_plugin_registry ( ) const
inline

Definition at line 1370 of file track.h.

◆ get_plugin_slot()

template<typename SelfT>
requires ( std::derived_from<SelfT, ChannelTrack> || std::is_same_v<SelfT, ModulatorTrack>)
plugins::PluginSlot zrythm::structure::tracks::Track::get_plugin_slot ( this const SelfT & self,
const PluginUuid & plugin_id )
inline

Definition at line 1194 of file track.h.

◆ get_plugins()

template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
void zrythm::structure::tracks::Track::get_plugins ( this DerivedT && self,
std::vector< zrythm::gui::old_dsp::plugins::Plugin * > & arr )
inline

Fills in the given array with all plugins in the track.

Definition at line 936 of file track.h.

◆ get_port_registry() [1/2]

auto & zrythm::structure::tracks::Track::get_port_registry ( )
inline

Definition at line 1373 of file track.h.

◆ get_port_registry() [2/2]

auto & zrythm::structure::tracks::Track::get_port_registry ( ) const
inline

Definition at line 1372 of file track.h.

◆ get_regions_in_range()

virtual void zrythm::structure::tracks::Track::get_regions_in_range ( std::vector< Region * > & regions,
const dsp::Position * p1,
const dsp::Position * p2 )
inlinevirtual

◆ get_soloed()

virtual bool zrythm::structure::tracks::Track::get_soloed ( ) const
inlinevirtual

Definition at line 1359 of file track.h.

◆ get_type()

auto zrythm::structure::tracks::Track::get_type ( ) const
inline

Definition at line 1377 of file track.h.

◆ get_type_for_class()

template<typename T>
static consteval Type zrythm::structure::tracks::Track::get_type_for_class ( )
inlinestaticconsteval

Definition at line 477 of file track.h.

◆ has_piano_roll()

bool zrythm::structure::tracks::Track::has_piano_roll ( ) const
inline

Definition at line 540 of file track.h.

◆ init_loaded()

◆ insert_plugin()

template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
PluginPtrVariant zrythm::structure::tracks::Track::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 )
inline

Wrapper over Channel.add_plugin() and ModulatorTrack.insert_modulator().

Parameters
instantiate_pluginWhether to attempt to instantiate the plugin.

Definition at line 1044 of file track.h.

◆ insert_region()

template<arrangement::FinalRegionSubclass RegionT, FinalClass SelfT>
void zrythm::structure::tracks::Track::insert_region ( this SelfT & self,
arrangement::ArrangerObjectUuidReference region_ref,
AutomationTrack * at,
std::optional< int > lane_pos,
std::optional< int > idx,
bool gen_name )
inline

Inserts a Region to the given lane or AutomationTrack of the track, at the given index.

The Region must be the main region (see ArrangerObjectInfo).

Parameters
atThe AutomationTrack of this Region, if automation region.
lane_posThe position of the lane to add to, if applicable.
idxThe index to insert the region at inside its parent, or nullopt to append.
gen_nameGenerate a unique region name or not. This will be 0 if the caller already generated a unique name.
Exceptions
ZrythmExceptionif the insertion fails.

Definition at line 688 of file track.h.

◆ is_audio()

bool zrythm::structure::tracks::Track::is_audio ( ) const
inline

Definition at line 558 of file track.h.

◆ is_audio_bus()

bool zrythm::structure::tracks::Track::is_audio_bus ( ) const
inline

Definition at line 553 of file track.h.

◆ is_audio_group()

bool zrythm::structure::tracks::Track::is_audio_group ( ) const
inline

Definition at line 551 of file track.h.

◆ is_chord()

bool zrythm::structure::tracks::Track::is_chord ( ) const
inline

Definition at line 556 of file track.h.

◆ is_copyable()

bool zrythm::structure::tracks::Track::is_copyable ( ) const
inline

Definition at line 568 of file track.h.

◆ is_deletable()

bool zrythm::structure::tracks::Track::is_deletable ( ) const
inline

Definition at line 567 of file track.h.

◆ is_enabled()

bool zrythm::structure::tracks::Track::is_enabled ( ) const
inline

Definition at line 1241 of file track.h.

◆ is_folder()

bool zrythm::structure::tracks::Track::is_folder ( ) const
inline

Definition at line 550 of file track.h.

◆ is_frozen()

bool zrythm::structure::tracks::Track::is_frozen ( ) const
inline

Definition at line 670 of file track.h.

◆ is_instrument()

bool zrythm::structure::tracks::Track::is_instrument ( ) const
inline

Definition at line 559 of file track.h.

◆ is_marker()

bool zrythm::structure::tracks::Track::is_marker ( ) const
inline

Definition at line 557 of file track.h.

◆ is_master()

bool zrythm::structure::tracks::Track::is_master ( ) const
inline

Definition at line 561 of file track.h.

◆ is_midi()

bool zrythm::structure::tracks::Track::is_midi ( ) const
inline

Definition at line 560 of file track.h.

◆ is_midi_bus()

bool zrythm::structure::tracks::Track::is_midi_bus ( ) const
inline

Definition at line 554 of file track.h.

◆ is_midi_group()

bool zrythm::structure::tracks::Track::is_midi_group ( ) const
inline

Definition at line 552 of file track.h.

◆ is_modulator()

bool zrythm::structure::tracks::Track::is_modulator ( ) const
inline

Definition at line 555 of file track.h.

◆ is_plugin_descriptor_valid_for_slot_type()

static bool zrythm::structure::tracks::Track::is_plugin_descriptor_valid_for_slot_type ( const plugins::PluginDescriptor & descr,
zrythm::plugins::PluginSlotType slot_type,
Track::Type track_type )
inlinestatic

Returns if descr can be dropped at slot_type in a track of type track_type.

Definition at line 1213 of file track.h.

◆ multiply_heights()

template<typename DerivedT>
requires std::derived_from<base_type<DerivedT>, Track> && FinalClass<base_type<DerivedT>>
bool zrythm::structure::tracks::Track::multiply_heights ( this DerivedT && self,
double multiplier,
bool visible_only,
bool check_only )
inline

Definition at line 603 of file track.h.

◆ remove_from_folder_parents()

void zrythm::structure::tracks::Track::remove_from_folder_parents ( )

Remove the track from all folders.

Used when deleting tracks.

◆ remove_plugin()

template<typename SelfT>
requires ( std::derived_from<SelfT, ChannelTrack> || std::is_same_v<SelfT, ModulatorTrack>)
void zrythm::structure::tracks::Track::remove_plugin ( this SelfT & self,
plugins::PluginSlot slot,
bool moving_plugin = false,
bool deleting_plugin = true )
inline

Removes a plugin at the given slot from the track.

Parameters
moving_pluginWhether or not we are moving the plugin.
deleting_pluginWhether or not we are deleting the plugin.

Definition at line 1110 of file track.h.

◆ set_comment()

void zrythm::structure::tracks::Track::set_comment ( const utils::Utf8String & comment,
bool undoable )
Parameters
undoableCreate an undable action.

◆ set_comment_with_action()

void zrythm::structure::tracks::Track::set_comment_with_action ( const utils::Utf8String & comment)
inline

Definition at line 1001 of file track.h.

◆ set_enabled()

void zrythm::structure::tracks::Track::set_enabled ( bool enabled)
inline

Definition at line 1244 of file track.h.

◆ set_index()

void zrythm::structure::tracks::Track::set_index ( int index)
inline

Definition at line 927 of file track.h.

◆ set_name()

void zrythm::structure::tracks::Track::set_name ( const Tracklist & tracklist,
const utils::Utf8String & name,
bool pub_events )

Setter for the track name.

If a track with that name already exists, it adds a number at the end.

Must only be called from the GTK thread.

◆ set_playback_caches()

virtual void zrythm::structure::tracks::Track::set_playback_caches ( )
inlineprotectedvirtual

◆ set_port_metadata_from_owner()

void zrythm::structure::tracks::Track::set_port_metadata_from_owner ( dsp::PortIdentifier & id,
PortRange & range ) const
overridevirtual

Function that will be called by the Port to update the identifier's relevant members based on this port owner.

Parameters
idThe identifier to update.

Implements IPortOwner.

◆ set_selection_status_getter()

void zrythm::structure::tracks::Track::set_selection_status_getter ( TrackSelectionStatusGetter getter)
inline

Definition at line 1361 of file track.h.

◆ should_be_visible()

bool zrythm::structure::tracks::Track::should_be_visible ( ) const

Returns whether the track should be visible.

Takes into account Track.visible and whether any of the track's foldable parents are folded.

◆ track_freeze()

void zrythm::structure::tracks::Track::track_freeze ( bool freeze)

Freezes or unfreezes the track.

When a track is frozen, it is bounced with effects to a temporary file in the pool, which is played back directly from disk.

When the track is unfrozen, this file will be removed from the pool and the track will be played normally again.

Remarks
Unimplemented/not used.
Exceptions
ZrythmExceptionon error.

◆ type_can_be_group_target()

static bool zrythm::structure::tracks::Track::type_can_be_group_target ( const Type type)
inlinestatic

Returns if the Track can be a direct route target.

Parameters
type
Returns
true
false

Definition at line 471 of file track.h.

◆ type_can_have_direct_out()

static constexpr bool zrythm::structure::tracks::Track::type_can_have_direct_out ( Type type)
inlinestaticconstexpr

Definition at line 392 of file track.h.

◆ type_can_have_region_type()

static bool zrythm::structure::tracks::Track::type_can_have_region_type ( Type type,
ArrangerObject::Type region_type )
inlinestatic

Definition at line 398 of file track.h.

◆ type_get_prefader_type()

static Fader::Type zrythm::structure::tracks::Track::type_get_prefader_type ( const Type type)
inlinestatic

Returns the prefader type.

Definition at line 369 of file track.h.

◆ type_has_inputs()

static constexpr bool zrythm::structure::tracks::Track::type_has_inputs ( const Type type)
inlinestaticconstexpr

Returns if the Track should have an inputs selector.

Definition at line 459 of file track.h.

◆ type_has_mono_compat_switch()

static consteval bool zrythm::structure::tracks::Track::type_has_mono_compat_switch ( const Type tt)
inlinestaticconsteval

Definition at line 432 of file track.h.

◆ type_has_piano_roll()

static constexpr bool zrythm::structure::tracks::Track::type_has_piano_roll ( const Type type)
inlinestaticconstexpr

Returns if the Track should have a piano roll.

Definition at line 451 of file track.h.

◆ type_is_compatible_for_moving()

static constexpr bool zrythm::structure::tracks::Track::type_is_compatible_for_moving ( const Type type1,
const Type type2 )
inlinestaticconstexpr

Returns if regions in tracks from type1 can be moved to type2.

Definition at line 441 of file track.h.

◆ type_is_copyable()

static constexpr bool zrythm::structure::tracks::Track::type_is_copyable ( Type type)
inlinestaticconstexpr

Definition at line 415 of file track.h.

◆ type_is_deletable()

static constexpr bool zrythm::structure::tracks::Track::type_is_deletable ( Type type)
inlinestaticconstexpr

Returns whether a track of the given type should be deletable by the user.

Definition at line 424 of file track.h.

◆ unset_selection_status_getter()

void zrythm::structure::tracks::Track::unset_selection_status_getter ( )
inline

Definition at line 1365 of file track.h.

◆ update_positions()

void zrythm::structure::tracks::Track::update_positions ( bool from_ticks,
bool bpm_change,
dsp::FramesPerTick frames_per_tick )

Updates the frames/ticks of each position in each child of the track recursively.

Parameters
from_ticksWhether to update the positions based on ticks (true) or frames (false).
frames_per_tickThis will be used when doing position conversions via dependency injection instead of relying on the current project's transport.

Friends And Related Symbol Documentation

◆ from_json

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

Definition at line 1431 of file track.h.

◆ operator<

bool operator< ( const Track & lhs,
const Track & rhs )
friend

Definition at line 1380 of file track.h.

◆ to_json

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

Definition at line 1415 of file track.h.

◆ Tracklist

friend class Tracklist
friend

Definition at line 293 of file track.h.

Field Documentation

◆ bounce_

bool zrythm::structure::tracks::Track::bounce_ {}

Set to ON during bouncing if this track should be included.

Only relevant for tracks that output audio.

Definition at line 1534 of file track.h.

◆ bounce_to_master_

bool zrythm::structure::tracks::Track::bounce_to_master_ = false

Whether to temporarily route the output to master (e.g., when bouncing the track on its own without its parents).

Definition at line 1540 of file track.h.

◆ color_

Color zrythm::structure::tracks::Track::color_
protected

Track color.

This is used in the channels as well.

Definition at line 1513 of file track.h.

◆ comment_

utils::Utf8String zrythm::structure::tracks::Track::comment_
protected

User comments.

Definition at line 1526 of file track.h.

◆ DEF_HEIGHT

int zrythm::structure::tracks::Track::DEF_HEIGHT = 52
staticconstexpr

Definition at line 291 of file track.h.

◆ disconnecting_

bool zrythm::structure::tracks::Track::disconnecting_ = false

Whether currently disconnecting.

Definition at line 1543 of file track.h.

◆ enabled_

bool zrythm::structure::tracks::Track::enabled_ = true
protected

Active (enabled) or not.

Disabled tracks should be ignored in routing. Similar to Plugin.enabled (bypass).

Definition at line 1506 of file track.h.

◆ filtered_

bool zrythm::structure::tracks::Track::filtered_ = false
protected

Track will be hidden if true (temporary and not serializable).

Definition at line 1495 of file track.h.

◆ frozen_clip_id_

std::optional<AudioClip::Uuid> zrythm::structure::tracks::Track::frozen_clip_id_

Pool ID of the clip if track is frozen (unset if not frozen).

Definition at line 1554 of file track.h.

◆ icon_name_

utils::Utf8String zrythm::structure::tracks::Track::icon_name_
protected

Icon name of the track.

Definition at line 1482 of file track.h.

◆ in_signal_type_

PortType zrythm::structure::tracks::Track::in_signal_type_ = {}
protected

The input signal type (eg audio bus tracks have audio input signals).

Definition at line 1518 of file track.h.

◆ main_height_

double zrythm::structure::tracks::Track::main_height_ { DEF_HEIGHT }
protected

Height of the main part (without lanes).

Definition at line 1498 of file track.h.

◆ MIN_HEIGHT

int zrythm::structure::tracks::Track::MIN_HEIGHT = 26
staticconstexpr

Definition at line 290 of file track.h.

◆ name_

utils::Utf8String zrythm::structure::tracks::Track::name_
protected

Track name, used in channel too.

Definition at line 1479 of file track.h.

◆ object_registry_

arrangement::ArrangerObjectRegistry& zrythm::structure::tracks::Track::object_registry_
protected

Definition at line 1465 of file track.h.

◆ out_signal_type_

PortType zrythm::structure::tracks::Track::out_signal_type_ = {}
protected

The output signal type (eg midi tracks have MIDI output signals).

Definition at line 1523 of file track.h.

◆ plugin_registry_

PluginRegistry& zrythm::structure::tracks::Track::plugin_registry_
protected

Definition at line 1463 of file track.h.

◆ port_registry_

PortRegistry& zrythm::structure::tracks::Track::port_registry_
protected

Definition at line 1464 of file track.h.

◆ pos_

int zrythm::structure::tracks::Track::pos_ = 0
protected

Position in the Tracklist.

This is also used in the Mixer for the Channels. If a track doesn't have a Channel, the Mixer can just skip.

Definition at line 1473 of file track.h.

◆ track_selection_status_getter_

std::optional<TrackSelectionStatusGetter> zrythm::structure::tracks::Track::track_selection_status_getter_

Track selection status getter.

To be set by the tracklist when a track gets added to it.

Definition at line 1564 of file track.h.

◆ tracklist_

Tracklist* zrythm::structure::tracks::Track::tracklist_ = nullptr

Pointer to owner tracklist, if any.

Definition at line 1557 of file track.h.

◆ trigger_midi_activity_

bool zrythm::structure::tracks::Track::trigger_midi_activity_ = false

Flag to tell the UI that this channel had MIDI activity.

When processing this and setting it to 0, the UI should create a separate event using EVENTS_PUSH.

Definition at line 1551 of file track.h.

◆ type_

Type zrythm::structure::tracks::Track::type_ = {}
protected

The type of track this is.

Definition at line 1476 of file track.h.

◆ visible_

bool zrythm::structure::tracks::Track::visible_ = true
protected

Track Widget created dynamically.

1 track has 1 widget. Whole Track is visible or not.

Definition at line 1492 of file track.h.


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