6#include "dsp/port_connections_manager.h"
7#include "gui/dsp/arranger_object_all.h"
8#include "gui/dsp/automation_tracklist.h"
9#include "gui/dsp/fader.h"
10#include "gui/dsp/plugin.h"
11#include "gui/dsp/track_lane.h"
12#include "utils/format.h"
17using namespace zrythm;
33#define DECLARE_FINAL_TRACK_CONSTRUCTORS(ClassType) \
37 TrackRegistry &track_registry, PluginRegistry &plugin_registry, \
38 PortRegistry &port_registry, ArrangerObjectRegistry &obj_registry, \
41#define DEFINE_TRACK_QML_PROPERTIES(ClassType) \
46 Q_PROPERTY (QString name READ getName WRITE setName NOTIFY nameChanged) \
47 QString getName () const \
49 return name_.to_qstring (); \
51 void setName (const QString &name) \
53 const auto name_str = utils::Utf8String::from_qstring (name); \
54 if (name_ == name_str) \
58 Q_EMIT nameChanged (name); \
61 Q_SIGNAL void nameChanged (const QString &name); \
66 Q_PROPERTY (QColor color READ getColor WRITE setColor NOTIFY colorChanged) \
68 QColor getColor () const \
70 return color_.to_qcolor (); \
72 void setColor (const QColor &color) \
74 if (color_.to_qcolor () == color) \
78 Q_EMIT colorChanged (color); \
81 Q_SIGNAL void colorChanged (const QColor &color); \
87 QString comment READ getComment WRITE setComment NOTIFY commentChanged) \
89 QString getComment () const \
91 return comment_.to_qstring (); \
93 void setComment (const QString &comment) \
95 const auto comment_str = utils::Utf8String::from_qstring (comment); \
96 if (comment_ == comment_str) \
99 comment_ = comment_str; \
100 Q_EMIT commentChanged (comment); \
103 Q_SIGNAL void commentChanged (const QString &comment); \
109 bool visible READ getVisible WRITE setVisible NOTIFY visibleChanged) \
110 bool getVisible () const \
114 void setVisible (bool visible) \
116 if (visible_ == visible) \
119 visible_ = visible; \
120 Q_EMIT visibleChanged (visible); \
123 Q_SIGNAL void visibleChanged (bool visible); \
129 bool enabled READ getEnabled WRITE setEnabled NOTIFY enabledChanged) \
130 bool getEnabled () const \
135 void setEnabled (bool enabled) \
137 set_enabled (enabled, true, true, true); \
139 Q_SIGNAL void enabledChanged (bool enabled); \
144 Q_PROPERTY (bool selected READ getSelected NOTIFY selectedChanged) \
145 bool getSelected () const \
147 if (track_selection_status_getter_) \
149 return (*track_selection_status_getter_) (get_uuid ()); \
153 Q_SIGNAL void selectedChanged (bool selected); \
158 Q_PROPERTY (int type READ getType CONSTANT) \
159 int getType () const \
161 return ENUM_VALUE_TO_INT (type_); \
166 Q_PROPERTY (bool isRecordable READ getIsRecordable CONSTANT) \
167 bool getIsRecordable () const \
169 if constexpr (std::derived_from<ClassType, RecordableTrack>) \
179 Q_PROPERTY (bool hasLanes READ getHasLanes CONSTANT) \
180 bool getHasLanes () const \
182 if constexpr (std::derived_from<ClassType, LanedTrack>) \
192 Q_PROPERTY (bool hasChannel READ getHasChannel CONSTANT) \
193 bool getHasChannel () const \
195 if constexpr (std::derived_from<ClassType, ChannelTrack>) \
205 Q_PROPERTY (bool isAutomatable READ getIsAutomatable CONSTANT) \
206 bool getIsAutomatable () const \
208 if constexpr (std::derived_from<ClassType, AutomatableTrack>) \
219 double height READ getHeight WRITE setHeight NOTIFY heightChanged) \
220 double getHeight () const \
222 return main_height_; \
224 void setHeight (double height) \
226 if (utils::math::floats_equal (height, main_height_)) \
230 main_height_ = height; \
231 Q_EMIT heightChanged (height); \
233 Q_SIGNAL void heightChanged (double height); \
235 double fullVisibleHeight READ getFullVisibleHeight NOTIFY \
236 fullVisibleHeightChanged) \
237 double getFullVisibleHeight () const \
239 return get_full_visible_height (); \
241 Q_SIGNAL void fullVisibleHeightChanged (); \
245 Q_PROPERTY (QString icon READ getIcon WRITE setIcon NOTIFY iconChanged) \
246 QString getIcon () const \
248 return icon_name_.to_qstring (); \
250 void setIcon (const QString &icon) \
252 const auto icon_str = utils::Utf8String::from_qstring (icon); \
253 if (icon_name_ == icon_str) \
257 icon_name_ = icon_str; \
258 Q_EMIT iconChanged (icon); \
260 Q_SIGNAL void iconChanged (const QString &icon);
287 using PortType = dsp::PortType;
288 using PluginRegistry = gui::old_dsp::plugins::PluginRegistry;
289 using PluginPtrVariant = PluginRegistry::VariantType;
292 using TrackSelectionStatusGetter = std::function<bool (
const TrackUuid &)>;
294 static constexpr int MIN_HEIGHT = 26;
295 static constexpr int DEF_HEIGHT = 52;
385 return Fader::Type::MidiChannel;
394 return Fader::Type::None;
396 z_return_val_if_reached (Fader::Type::None);
400 static constexpr bool type_can_have_direct_out (
Type type)
410 case ArrangerObject::Type::AudioRegion:
412 case ArrangerObject::Type::MidiRegion:
414 case ArrangerObject::Type::ChordRegion:
416 case ArrangerObject::Type::AutomationRegion:
419 throw std::runtime_error (
"Invalid region type");
423 static constexpr bool type_is_copyable (
Type type)
434 return type_is_copyable (type);
437 static Type type_get_from_plugin_descriptor (
440 static consteval bool type_has_mono_compat_switch (
const Type tt)
448 static constexpr bool
485 template <
typename T>
static consteval Type get_type_for_class ()
487 if constexpr (std::is_same_v<T, MidiTrack>)
489 else if constexpr (std::is_same_v<T, AudioTrack>)
491 else if constexpr (std::is_same_v<T, ChordTrack>)
493 else if constexpr (std::is_same_v<T, InstrumentTrack>)
495 else if constexpr (std::is_same_v<T, AudioBusTrack>)
497 else if constexpr (std::is_same_v<T, MidiBusTrack>)
499 else if constexpr (std::is_same_v<T, MasterTrack>)
501 else if constexpr (std::is_same_v<T, TempoTrack>)
503 else if constexpr (std::is_same_v<T, ModulatorTrack>)
505 else if constexpr (std::is_same_v<T, MarkerTrack>)
507 else if constexpr (std::is_same_v<T, FolderTrack>)
509 else if constexpr (std::is_same_v<T, AudioGroupTrack>)
511 else if constexpr (std::is_same_v<T, MidiGroupTrack>)
515 static_assert (dependent_false_v<T>,
"Unknown track type");
521 Q_DISABLE_COPY_MOVE (
Track)
523 [[nodiscard]]
static TrackUniquePtrVariant
524 create_unique_from_type (
Type type);
534 PortType in_signal_type,
535 PortType out_signal_type,
536 PluginRegistry &plugin_registry,
537 PortRegistry &port_registry,
538 ArrangerObjectRegistry &obj_registry);
547 init_loaded (PluginRegistry &plugin_registry, PortRegistry &port_registry) = 0;
577 static Track * from_variant (
const TrackPtrVariant &variant);
582 bool is_copyable ()
const {
return type_is_copyable (
type_); }
589 template <
typename DerivedT>
591 requires std::derived_from<base_type<DerivedT>,
Track>
594 double height = self.main_height_;
596 if constexpr (std::derived_from<DerivedT, LanedTrack>)
598 height += self.get_visible_lane_heights ();
600 if constexpr (std::derived_from<DerivedT, AutomatableTrack>)
602 if (self.automation_visible_)
605 for (
const auto &at : atl.get_visible_automation_tracks ())
607 z_warn_if_fail (at->height_ > 0);
609 height += at->height_;
616 template <
typename DerivedT>
617 bool multiply_heights (
618 this DerivedT &&self,
622 requires std::derived_from<base_type<DerivedT>,
Track>
625 if (self.main_height_ * multiplier < MIN_HEIGHT)
630 self.main_height_ *= multiplier;
633 if constexpr (std::derived_from<DerivedT, LanedTrack>)
635 if (!visible_only || self.lanes_visible_)
637 for (
auto &lane_var : self.lanes_)
639 using TrackLaneT = DerivedT::TrackLaneType;
640 auto lane = std::get<TrackLaneT *> (lane_var);
641 if (lane->height_ * multiplier < MIN_HEIGHT)
648 lane->height_ *= multiplier;
653 if constexpr (std::derived_from<DerivedT, AutomatableTrack>)
655 if (!visible_only || self.automation_visible_)
657 auto &atl = self.get_automation_tracklist ();
658 for (
auto &at : atl.ats_)
660 if (visible_only && !at->visible_)
663 if (at->height_ * multiplier < MIN_HEIGHT)
670 at->height_ *= multiplier;
701 template <FinalRegionSub
class RegionT, FinalClass SelfT>
704 ArrangerObjectUuidReference region_ref,
706 std::optional<int> lane_pos,
707 std::optional<int> idx,
710 auto * region = std::get<RegionT *> (region_ref.get_object ());
712 assert (type_can_have_region_type (self.type_, region->get_type ()));
718 region->generate_name_from_automation_track (self, *at);
722 region->generate_name_from_track (self);
726 assert (!region->get_name ().empty ());
728 "inserting region '{}' to track '{}' at lane {} (idx {})",
729 region->get_name (), self.name_, lane_pos, idx);
731 region->set_track_id (self.get_uuid ());
734 std::derived_from<RegionT, LaneOwnedObject>
735 && std::derived_from<SelfT, LanedTrack>)
738 self.create_missing_lanes (*lane_pos);
740 auto lane = std::get<typename SelfT::TrackLaneType *> (
741 self.lanes_.at (*lane_pos));
742 if (idx.has_value ())
744 lane->insert_object (region_ref, *idx);
748 lane->add_object (region_ref);
751 else if constexpr (std::is_same_v<RegionT, AutomationRegion>)
753 assert (at !=
nullptr);
754 if (idx.has_value ())
756 at->insert_object (region_ref, *idx);
760 at->add_object (region_ref);
764 std::is_same_v<RegionT, ChordRegion> && std::is_same_v<SelfT, ChordTrack>)
766 if (idx.has_value ())
768 self.ArrangerObjectOwner<ChordRegion>::insert_object (
773 self.ArrangerObjectOwner<ChordRegion>::add_object (region_ref);
778 if constexpr (std::is_same_v<RegionT, AudioRegion>)
780 if (!self.is_auditioner ())
782 auto * clip = region->get_clip ();
783 self.write_audio_clip_to_pool_after_adding_audio_region (*clip);
787 z_debug (
"inserted: {}", *region);
792 write_audio_clip_to_pool_after_adding_audio_region (
AudioClip &clip)
const;
801 template <FinalRegionSub
class RegionT>
806 std::optional<int> lane_pos,
810 region_ref, at, lane_pos, std::nullopt, gen_name);
828 template <
typename DerivedT>
829 bool contains_uninstantiated_plugin (
this DerivedT &&self)
830 requires std::derived_from<base_type<DerivedT>,
Track>
833 std::vector<zrythm::gui::old_dsp::plugins::Plugin *> plugins;
834 self.get_plugins (plugins);
835 return std::ranges::any_of (plugins, [] (
auto pl) {
836 return pl->instantiation_failed_;
867 std::vector<FoldableTrack *> parents;
869 if (!parents.empty ())
871 return parents.front ();
938 std::vector<Region *> ®ions,
945 int get_index ()
const {
return pos_; }
946 void set_index (
int index) {
pos_ = index; }
954 template <
typename DerivedT>
956 this DerivedT &&self,
957 std::vector<zrythm::gui::old_dsp::plugins::Plugin *> &arr)
958 requires std::derived_from<base_type<DerivedT>,
Track>
961 if constexpr (std::derived_from<DerivedT, ChannelTrack>)
963 self.channel_->get_plugins (arr);
966 if constexpr (std::is_same_v<DerivedT, ModulatorTrack>)
968 for (
const auto &modulator : self.modulators_)
972 arr.push_back (modulator.get ());
984 template <
typename DerivedT>
986 requires std::derived_from<base_type<DerivedT>,
Track>
989 std::vector<zrythm::gui::old_dsp::plugins::Plugin *> pls;
990 self.get_plugins (pls);
994 if (!pl->instantiated_ && !pl->instantiation_failed_)
1002 e.handle (
"Failed to instantiate plugin");
1006 if (pl->instantiated_)
1008 pl->activate (activate);
1028 void set_color (
const Color &color,
bool undoable,
bool fire_events);
1062 template <
typename DerivedT>
1064 this DerivedT &&self,
1065 PluginUuid plugin_id,
1067 bool instantiate_plugin,
1068 bool replacing_plugin,
1071 bool gen_automatables,
1074 requires std::derived_from<base_type<DerivedT>,
Track>
1077 if (!slot.validate_slot_type_slot_combo ())
1079 throw std::runtime_error (
"Invalid slot type and slot combo");
1082 PluginPtrVariant plugin_var{};
1084 if (slot.is_modulator ())
1086 if constexpr (std::is_same_v<DerivedT, ModulatorTrack>)
1088 plugin_var = self.insert_modulator (
1089 slot.get_slot_with_index ().second, plugin_id, replacing_plugin,
1090 confirm, gen_automatables, recalc_graph, fire_events);
1095 if constexpr (std::derived_from<DerivedT, ChannelTrack>)
1097 plugin_var = self.get_channel ()->add_plugin (
1098 plugin_id, slot, confirm, moving_plugin, gen_automatables,
1099 recalc_graph, fire_events);
1104 [&] (
auto &&plugin) {
1105 if (plugin && !plugin->instantiated_ && !plugin->instantiation_failed_)
1109 plugin->instantiate ();
1113 e.handle (
"Failed to instantiate plugin");
1126 template <
typename SelfT>
1129 std::derived_from<SelfT, ChannelTrack>
1130 || std::is_same_v<SelfT, ModulatorTrack>)
1132 z_debug (
"removing plugin from track {}", self.name_);
1133 if constexpr (std::is_same_v<SelfT, ModulatorTrack>)
1135 assert (slot.is_modulator ());
1136 self.remove_modulator (slot.get_slot_with_index ().second);
1138 else if constexpr (std::derived_from<SelfT, ChannelTrack>)
1140 assert (!slot.is_modulator ());
1141 self.get_channel ()->remove_plugin_from_channel (slot,
false,
true);
1145 template <
typename SelfT>
1147 get_plugin_slot (
this const SelfT &self,
const PluginUuid &plugin_id)
1149 std::derived_from<SelfT, ChannelTrack>
1150 || std::is_same_v<SelfT, ModulatorTrack>)
1152 if constexpr (std::derived_from<SelfT, ChannelTrack>)
1154 return self.channel_->get_plugin_slot (plugin_id);
1156 else if constexpr (std::is_same_v<SelfT, ModulatorTrack>)
1158 return self.modulator_->get_plugin_slot (plugin_id);
1168 zrythm::plugins::PluginSlotType slot_type,
1173 case zrythm::plugins::PluginSlotType::Insert:
1182 case zrythm::plugins::PluginSlotType::MidiFx:
1185 case zrythm::plugins::PluginSlotType::Instrument:
1191 z_return_val_if_reached (
false);
1200 bool is_enabled ()
const {
return enabled_; }
1201 bool get_enabled ()
const {
return enabled_; }
1202 bool get_disabled ()
const {
return !
enabled_; }
1203 void set_enabled (
bool enabled) {
enabled_ = enabled; }
1211 int get_total_bars (
const Transport &transport,
int total_bars)
const;
1235 int disable_track_idx,
1264 template <
typename T = Track>
1270 get_type_for_class<T> (), pl_setting, index));
1284 return dynamic_cast<T *
> (
1295 [[nodiscard]]
static TrackUniquePtrVariant
1300 bool is_in_active_project ()
const override;
1308 virtual bool get_muted ()
const {
return false; }
1310 virtual bool get_listened ()
const {
return false; }
1318 virtual bool get_soloed ()
const {
return false; }
1320 void set_selection_status_getter (TrackSelectionStatusGetter getter)
1324 void unset_selection_status_getter ()
1329 auto &get_plugin_registry ()
const {
return plugin_registry_; }
1330 auto &get_plugin_registry () {
return plugin_registry_; }
1331 auto &get_port_registry ()
const {
return port_registry_; }
1332 auto &get_port_registry () {
return port_registry_; }
1333 auto &get_object_registry ()
const {
return object_registry_; }
1334 auto &get_object_registry () {
return object_registry_; }
1336 auto get_type ()
const {
return type_; }
1337 auto get_icon_name ()
const {
return icon_name_; }
1339 friend bool operator< (
const Track &lhs,
const Track &rhs)
1347 bool validate_base ()
const;
1356 void add_region_if_in_range (
1359 std::vector<Region *> ®ions,
1363 static constexpr std::string_view kTypeKey =
"type";
1364 static constexpr std::string_view kNameKey =
"name";
1365 static constexpr std::string_view kIconNameKey =
"iconName";
1366 static constexpr std::string_view kIndexKey =
"index";
1367 static constexpr std::string_view kVisibleKey =
"visible";
1368 static constexpr std::string_view kMainHeightKey =
"mainHeight";
1369 static constexpr std::string_view kEnabledKey =
"enabled";
1370 static constexpr std::string_view kColorKey =
"color";
1371 static constexpr std::string_view kInputSignalTypeKey =
"inSignalType";
1372 static constexpr std::string_view kOutputSignalTypeKey =
"outSignalType";
1373 static constexpr std::string_view kCommentKey =
"comment";
1374 static constexpr std::string_view kFrozenClipIdKey =
"frozenClipId";
1375 friend void to_json (nlohmann::json &j,
const Track &track)
1377 to_json (j,
static_cast<const UuidIdentifiableObject &
> (track));
1378 j[kTypeKey] = track.
type_;
1379 j[kNameKey] = track.
name_;
1381 j[kIndexKey] = track.
pos_;
1385 j[kColorKey] = track.
color_;
1391 friend void from_json (
const nlohmann::json &j,
Track &track)
1393 from_json (j,
static_cast<UuidIdentifiableObject &
> (track));
1394 j.at (kTypeKey).get_to (track.
type_);
1395 j.at (kNameKey).get_to (track.
name_);
1396 j.at (kIconNameKey).get_to (track.
icon_name_);
1397 j.at (kIndexKey).get_to (track.
pos_);
1398 j.at (kVisibleKey).get_to (track.
visible_);
1400 j.at (kEnabledKey).get_to (track.
enabled_);
1401 j.at (kColorKey).get_to (track.
color_);
1404 j.at (kCommentKey).get_to (track.
comment_);
1417 static Track * create_without_file_with_action (
1419 const zrythm::plugins::PluginConfiguration * pl_setting,
1423 PluginRegistry &plugin_registry_;
1424 PortRegistry &port_registry_;
1425 ArrangerObjectRegistry &object_registry_;
1527DEFINE_ENUM_FORMATTER (
1530 QT_TR_NOOP_UTF8 (
"Instrument"),
1531 QT_TR_NOOP_UTF8 (
"Audio"),
1532 QT_TR_NOOP_UTF8 (
"Master"),
1533 QT_TR_NOOP_UTF8 (
"Chord"),
1534 QT_TR_NOOP_UTF8 (
"Marker"),
1535 QT_TR_NOOP_UTF8 (
"Tempo"),
1536 QT_TR_NOOP_UTF8 (
"Modulator"),
1537 QT_TR_NOOP_UTF8 (
"Audio FX"),
1538 QT_TR_NOOP_UTF8 (
"Audio Group"),
1539 QT_TR_NOOP_UTF8 (
"MIDI"),
1540 QT_TR_NOOP_UTF8 (
"MIDI FX"),
1541 QT_TR_NOOP_UTF8 (
"MIDI Group"),
1542 QT_TR_NOOP_UTF8 (
"Folder"));
1544template <
typename T>
1547template <
typename TrackT>
1550template <
typename TrackT>
1553 && (std::derived_from<TrackT, ChannelTrack> || std::is_same_v<TrackT, ModulatorTrack>);
1556using TrackRegistryRef = std::reference_wrapper<TrackRegistry>;
1558using TrackSelectionManager =
Audio clips for the pool.
Each track has an automation tracklist with automation tracks to be generated at runtime,...
Abstract class for a track that has a channel in the mixer.
@ AudioChannel
Audio fader for Channel's.
Abstract base for a foldable track.
Abstract base class for a track that can be routed to.
A region (clip) is an object on the timeline that contains either MidiNote's or AudioClip's.
Represents a track in the project.
std::optional< AudioClip::Uuid > frozen_clip_id_
Pool ID of the clip if track is frozen (unset if not frozen).
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.
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...
std::optional< TrackSelectionStatusGetter > track_selection_status_getter_
Track selection status getter.
void set_caches(CacheType types)
Set various caches (snapshots, track name hash, plugin input/output ports, etc).
int pos_
Position in the Tracklist.
bool disconnecting_
Whether currently disconnecting.
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().
static constexpr bool type_has_inputs(const Type type)
Returns if the Track should have an inputs selector.
bool filtered_
Track will be hidden if true (temporary and not serializable).
static Track * create_empty_at_idx_with_action(Type type, int index)
Creates a new empty track at the given index.
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.
bool visible_
Track Widget created dynamically.
bool bounce_
Set to ON during bouncing if this track should be included.
utils::Utf8String name_
Track name, used in channel too.
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 TrackUniquePtrVariant create_track(Type type, const utils::Utf8String &name, int pos)
Create a track of the given type with the given name and position.
bool bounce_to_master_
Whether to temporarily route the output to master (e.g., when bouncing the track on its own without i...
bool enabled_
Active (enabled) or not.
static Track * create_empty_with_action(Type type)
Creates a new empty track at the end of the tracklist.
utils::Utf8String comment_
User comments.
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 po...
@ Marker
Marker Track's contain named markers at specific Position's in the song.
@ AudioGroup
Group Tracks are used for grouping audio signals, for example routing multiple drum tracks to a "Drum...
@ AudioBus
Buses are channels that receive audio input and have effects on their channel strip.
@ Modulator
Special track to contain global Modulator's.
@ Midi
Midi tracks can only have MIDI effects in the strip and produce MIDI output that can be routed to ins...
@ Instrument
Instrument tracks must have an Instrument plugin at the first slot and they produce audio output.
@ Folder
Foldable track used for visual grouping.
@ Audio
Audio tracks can record and contain audio clips.
@ MidiGroup
Same with audio group but for MIDI signals.
@ MidiBus
Same with audio bus but for MIDI signals.
@ Tempo
Special track for BPM (tempo) and time signature events.
@ Chord
The chord track contains chords that can be used to modify midi in real time or to color the piano ro...
@ Master
The master track is a special type of group track.
void add_folder_parents(std::vector< FoldableTrack * > &parents, bool prepend) const
Adds the track's folder parents to the given vector.
double main_height_
Height of the main part (without lanes).
void unselect_all()
Unselects all arranger objects in the track.
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.
utils::Utf8String get_name() const
Getter for the track name.
void set_name(const Tracklist &tracklist, const utils::Utf8String &name, bool pub_events)
Setter for the track name.
Tracklist * tracklist_
Pointer to owner tracklist, if any.
double get_full_visible_height(this DerivedT &&self)
Returns the full visible height (main height + height of all visible automation tracks + height of al...
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.
virtual void init_loaded(PluginRegistry &plugin_registry, PortRegistry &port_registry)=0
Adds additional metadata to track members after deserialization.
bool set_name_with_action_full(const utils::Utf8String &name)
Internally called by set_name_with_action().
utils::Utf8String get_node_name() const override
Returns a human friendly name of the node.
PortType out_signal_type_
The output signal type (eg midi tracks have MIDI output signals).
void set_comment(const utils::Utf8String &comment, bool undoable)
static Track * create_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.
utils::Utf8String icon_name_
Icon name of the track.
PortType in_signal_type_
The input signal type (eg audio bus tracks have audio input signals).
FoldableTrack * get_direct_folder_parent() const
Returns the closest foldable parent or NULL.
virtual void get_regions_in_range(std::vector< Region * > ®ions, 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.
void set_name_with_action(const utils::Utf8String &name)
Setter to be used by the UI to create an undoable action.
virtual void set_playback_caches()
Set the playback caches for a track.
void track_freeze(bool freeze)
Freezes or unfreezes the track.
void insert_region(this SelfT &self, 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 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 set_color(const Color &color, bool undoable, bool fire_events)
Sets the track color.
static constexpr bool type_has_piano_roll(const Type type)
Returns if the Track should have a piano roll.
bool is_auditioner() const
Whether this track is part of the SampleProcessor auditioner tracklist.
bool should_be_visible() const
Returns whether the track should be visible.
virtual void clear_objects()
Removes all objects recursively from the track.
void disconnect_track()
Disconnects the track from the processing chain and removes any plugins it contains.
void remove_from_folder_parents()
Remove the track from all folders.
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 Fader::Type type_get_prefader_type(const Type type)
Returns the prefader type.
static constexpr bool type_is_deletable(Type type)
Returns whether a track of the given type should be deletable by the user.
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 bool validate() const =0
Verifies the identifiers on a live Track (in the project, not a clone).
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 set_icon(const utils::Utf8String &icon_name, bool undoable, bool fire_events)
Sets the track icon.
void remove_plugin(this SelfT &self, plugins::PluginSlot slot)
Wrapper over Channel::remove_plugin() and ModulatorTrack::remove_modulator().
void activate_all_plugins(this DerivedT &&self, bool activate)
Activate or deactivate all plugins.
bool trigger_midi_activity_
Flag to tell the UI that this channel had MIDI activity.
static bool type_can_be_group_target(const Type type)
Returns if the Track can be a direct route target.
Type type_
The type of track this is.
The Tracklist contains all the tracks in the Project.
Port connections manager.
Struct used to identify Ports in the project.
Represents the position of an object.
Interface for objects that can be processed in the DSP graph.
Configuration for instantiating a plugin descriptor.
The PluginDescriptor class provides a set of static utility functions and member functions to work wi...
int num_midi_outs_
Number of MIDI output ports.
int num_audio_outs_
Number of audio output ports.
A registry that owns and manages objects identified by a UUID.
Lightweight UTF-8 string wrapper with safe conversions.
Base class for objects that need to be uniquely identified by UUID.
A reference-counted RAII wrapper for a UUID in a registry.
Base class for exceptions in Zrythm.
void(*)(const FileImportInfo *) TracksReadyCallback
Called when track(s) are actually imported into the project.