56 Q_PROPERTY (
Type type READ type CONSTANT)
59 automationTracklist CONSTANT)
60 Q_PROPERTY (QString name READ name WRITE setName NOTIFY nameChanged)
61 Q_PROPERTY (QColor color READ color WRITE setColor NOTIFY colorChanged)
63 QString comment READ comment WRITE setComment NOTIFY commentChanged)
64 Q_PROPERTY (QString icon READ icon WRITE setIcon NOTIFY iconChanged)
65 Q_PROPERTY (
bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
66 Q_PROPERTY (
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
67 Q_PROPERTY (
bool isDeletable READ is_deletable CONSTANT)
68 Q_PROPERTY (
double height READ height WRITE setHeight NOTIFY heightChanged)
70 double fullVisibleHeight READ fullVisibleHeight NOTIFY
71 fullVisibleHeightChanged)
78 recordableTrackMixin CONSTANT)
81 pianoRollTrackMixin CONSTANT)
83 bool clipLauncherMode READ clipLauncherMode WRITE setClipLauncherMode NOTIFY
84 clipLauncherModeChanged)
87 playbackCacheActivityTracker READ playbackCacheActivityTracker CONSTANT)
91 using Plugin = plugins::Plugin;
92 using PluginUuid = Plugin::
Uuid;
93 using PortType = dsp::PortType;
94 using PluginRegistry = plugins::PluginRegistry;
95 using PluginPtrVariant = PluginRegistry::VariantType;
96 using ArrangerObject = structure::arrangement::ArrangerObject;
97 using ArrangerObjectPtrVariant =
98 structure::arrangement::ArrangerObjectPtrVariant;
99 using ArrangerObjectRegistry = structure::arrangement::ArrangerObjectRegistry;
102 enum class
Type : uint8_t
168 static constexpr int MIN_HEIGHT = 26;
169 static constexpr int DEF_HEIGHT = 52;
176 case ArrangerObject::Type::AudioRegion:
178 case ArrangerObject::Type::MidiRegion:
180 case ArrangerObject::Type::ChordRegion:
182 case ArrangerObject::Type::AutomationRegion:
185 throw std::runtime_error (
"Invalid region type");
189 static constexpr bool type_is_foldable (
Type type)
195 static constexpr bool type_is_copyable (
Type type)
206 return type_is_copyable (type);
209 static Type type_get_from_plugin_descriptor (
212 static consteval bool type_has_mono_compat_switch (
const Type tt)
220 static constexpr bool
257 static constexpr bool type_can_have_automation (
const Type type)
266 static constexpr bool type_can_have_lanes (
const Type type)
271 template <
typename T>
static consteval Type get_type_for_class ()
273 if constexpr (std::is_same_v<T, MidiTrack>)
275 else if constexpr (std::is_same_v<T, AudioTrack>)
277 else if constexpr (std::is_same_v<T, ChordTrack>)
279 else if constexpr (std::is_same_v<T, InstrumentTrack>)
281 else if constexpr (std::is_same_v<T, AudioBusTrack>)
283 else if constexpr (std::is_same_v<T, MidiBusTrack>)
285 else if constexpr (std::is_same_v<T, MasterTrack>)
287 else if constexpr (std::is_same_v<T, ModulatorTrack>)
289 else if constexpr (std::is_same_v<T, MarkerTrack>)
291 else if constexpr (std::is_same_v<T, FolderTrack>)
293 else if constexpr (std::is_same_v<T, AudioGroupTrack>)
295 else if constexpr (std::is_same_v<T, MidiGroupTrack>)
299 static_assert (dependent_false_v<T>,
"Unknown track type");
305 Q_DISABLE_COPY_MOVE (
Track)
308 enum class TrackFeatures : std::uint8_t
322 std::optional<PortType> in_signal_type,
323 std::optional<PortType> out_signal_type,
324 TrackFeatures enabled_features,
349 AutomationTracklist * automationTracklist ()
const
354 QString name ()
const {
return name_.to_qstring (); }
355 void setName (
const QString &name)
357 const auto name_str = utils::Utf8String::from_qstring (name);
358 if (
name_ == name_str)
362 Q_EMIT nameChanged (name);
364 Q_SIGNAL
void nameChanged (
const QString &name);
366 QColor color ()
const {
return color_.to_qcolor (); }
367 void setColor (
const QColor &color)
369 if (
color_.to_qcolor () == color)
373 Q_EMIT colorChanged (color);
375 Q_SIGNAL
void colorChanged (
const QColor &color);
377 QString comment ()
const {
return comment_.to_qstring (); }
378 void setComment (
const QString &comment)
380 const auto comment_str = utils::Utf8String::from_qstring (comment);
385 Q_EMIT commentChanged (comment);
387 Q_SIGNAL
void commentChanged (
const QString &comment);
389 bool visible ()
const {
return visible_; }
390 void setVisible (
bool visible)
396 Q_EMIT visibleChanged (visible);
398 Q_SIGNAL
void visibleChanged (
bool visible);
400 bool enabled ()
const {
return enabled_; }
401 void setEnabled (
bool enabled)
406 Q_EMIT enabledChanged (enabled);
408 Q_SIGNAL
void enabledChanged (
bool enabled);
411 void setHeight (
double height)
416 height = std::max (
static_cast<double> (Track::MIN_HEIGHT), height);
418 Q_EMIT heightChanged (height);
420 Q_SIGNAL
void heightChanged (
double height);
423 Q_SIGNAL
void fullVisibleHeightChanged ();
425 QString icon ()
const {
return icon_name_.to_qstring (); }
426 void setIcon (
const QString &icon)
428 const auto icon_str = utils::Utf8String::from_qstring (icon);
434 Q_EMIT iconChanged (icon);
436 Q_SIGNAL
void iconChanged (
const QString &icon);
438 Channel * channel ()
const {
return channel_.get (); }
440 plugins::PluginGroup * modulators ()
const {
return modulators_.get (); }
442 TrackLaneList * lanes ()
const {
return lanes_.get (); }
444 RecordableTrackMixin * recordableTrackMixin ()
const
446 return recordable_track_mixin_.get ();
449 PianoRollTrackMixin * pianoRollTrackMixin ()
const
451 return piano_roll_track_mixin_.get ();
454 bool clipLauncherMode ()
const {
return clip_launcher_mode_; }
455 void setClipLauncherMode (
bool mode);
456 Q_SIGNAL
void clipLauncherModeChanged (
bool mode);
460 playbackCacheActivityTracker ()
const
462 return playback_cache_activity_tracker_.get ();
479 bool is_copyable ()
const {
return type_is_copyable (
type_); }
480 bool has_automation ()
const {
return automationTracklist () !=
nullptr; }
488 bool multiply_heights (
double multiplier,
bool visible_only,
bool check_only);
497 template <arrangement::RegionObject RegionT>
498 auto generate_name_for_region (
499 const RegionT ®ion,
503 if constexpr (std::is_same_v<RegionT, arrangement::AutomationRegion>)
505 assert (automation_track !=
nullptr);
508 "{} - {}",
get_name (), automation_track->parameter ()->label ()));
517 std::vector<ArrangerObjectPtrVariant> &objects)
const;
519 bool contains_uninstantiated_plugin ()
const;
533 uint8_t
get_midi_ch (
const arrangement::MidiRegion &midi_region)
const;
538 void collect_plugins (std::vector<plugins::PluginPtrVariant> &plugins)
const;
546 static bool is_plugin_descriptor_valid_for_slot_type (
548 zrythm::plugins::PluginSlotType slot_type,
563 auto &get_plugin_registry ()
const
565 return base_dependencies_.plugin_registry_;
567 auto &get_plugin_registry () {
return base_dependencies_.plugin_registry_; }
568 auto &get_port_registry ()
const {
return base_dependencies_.port_registry_; }
569 auto &get_port_registry () {
return base_dependencies_.port_registry_; }
570 auto &get_param_registry ()
const
572 return base_dependencies_.param_registry_;
574 auto &get_param_registry () {
return base_dependencies_.param_registry_; }
575 auto &get_object_registry ()
const
577 return base_dependencies_.obj_registry_;
579 auto &get_object_registry () {
return base_dependencies_.obj_registry_; }
581 TrackProcessor * get_track_processor ()
const {
return processor_.get (); }
583 auto get_icon_name ()
const {
return icon_name_; }
589 void generate_automation_tracks_for_processor (
593 structure::tracks::generate_automation_tracks_for_processor (
594 ats, processor, base_dependencies_.tempo_map_,
595 base_dependencies_.file_audio_source_registry_,
596 base_dependencies_.obj_registry_);
603 std::optional<TrackProcessor::FillEventsCallback> fill_events_cb =
605 std::optional<TrackProcessor::TransformMidiInputsFunc>
606 transform_midi_inputs_func = std::nullopt,
607 std::optional<TrackProcessor::AppendMidiInputsToOutputsFunc>
608 append_midi_inputs_to_outputs_func = std::nullopt);
615 std::vector<ArrangerObjectPtrVariant> &objects)
const
620 static constexpr auto kNameKey =
"name"sv;
621 static constexpr auto kIconNameKey =
"iconName"sv;
622 static constexpr auto kVisibleKey =
"visible"sv;
623 static constexpr auto kMainHeightKey =
"mainHeight"sv;
624 static constexpr auto kEnabledKey =
"enabled"sv;
625 static constexpr auto kColorKey =
"color"sv;
626 static constexpr auto kInputSignalTypeKey =
"inSignalType"sv;
627 static constexpr auto kOutputSignalTypeKey =
"outSignalType"sv;
628 static constexpr auto kCommentKey =
"comment"sv;
629 static constexpr auto kFrozenClipIdKey =
"frozenClipId"sv;
630 static constexpr auto kProcessorKey =
"processor"sv;
631 static constexpr auto kAutomationTracklistKey =
"automationTracklist"sv;
632 static constexpr auto kChannelKey =
"channel"sv;
633 static constexpr auto kModulatorsKey =
"modulators"sv;
634 static constexpr auto kModulatorMacroProcessorsKey =
635 "modulatorMacroProcessors"sv;
636 static constexpr auto kRecordingParamKey =
"recordingParam"sv;
637 static constexpr auto kPianoRollKey =
"pianoRoll"sv;
638 static constexpr auto kClipLauncherModeKey =
"clipLauncherMode"sv;
639 friend void to_json (nlohmann::json &j,
const Track &track);
640 friend void from_json (
const nlohmann::json &j,
Track &track);
643 make_automation_tracklist ();
649 make_recordable_track_mixin ();
651 make_piano_roll_track_mixin ();
658 void init_cache_scheduler ();
675 TrackFeatures features_{};
748 std::vector<utils::QObjectUniquePtr<dsp::ModulatorMacroProcessor>>
763 bool clip_launcher_mode_{};
765 playback_cache_activity_tracker_;
767 BOOST_DESCRIBE_CLASS (
786 recordable_track_mixin_,
787 piano_roll_track_mixin_,
788 clip_launcher_mode_),