62 Q_PROPERTY (
Type type READ type CONSTANT)
65 automationTracklist CONSTANT)
66 Q_PROPERTY (QString name READ name WRITE setName NOTIFY nameChanged)
67 Q_PROPERTY (QColor color READ color WRITE setColor NOTIFY colorChanged)
69 QString comment READ comment WRITE setComment NOTIFY commentChanged)
70 Q_PROPERTY (QString icon READ icon WRITE setIcon NOTIFY iconChanged)
71 Q_PROPERTY (
bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
72 Q_PROPERTY (
bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
73 Q_PROPERTY (
bool isDeletable READ is_deletable CONSTANT)
74 Q_PROPERTY (
double height READ height WRITE setHeight NOTIFY heightChanged)
76 double fullVisibleHeight READ fullVisibleHeight NOTIFY
77 fullVisibleHeightChanged)
88 pianoRollTrackMixin CONSTANT)
90 bool clipLauncherMode READ clipLauncherMode WRITE setClipLauncherMode NOTIFY
91 clipLauncherModeChanged)
94 timebaseProvider CONSTANT)
97 playbackCacheActivityTracker READ playbackCacheActivityTracker CONSTANT)
104 using PluginUuid = plugins::Plugin::
Uuid;
105 using PortType = dsp::PortType;
106 using ArrangerObject = structure::arrangement::ArrangerObject;
107 using ArrangerObjectPtrVariant =
108 structure::arrangement::ArrangerObjectPtrVariant;
109 using Color =
utils::Color;
177 static constexpr int MIN_HEIGHT = 26;
178 static constexpr int DEF_HEIGHT = 52;
185 case ArrangerObject::Type::AudioClip:
187 case ArrangerObject::Type::MidiClip:
189 case ArrangerObject::Type::ChordClip:
191 case ArrangerObject::Type::AutomationClip:
194 throw std::runtime_error (
"Invalid clip type");
198 static constexpr bool type_is_foldable (
Type type)
204 static constexpr bool type_is_copyable (
Type type)
215 return type_is_copyable (type);
218 static Type type_get_from_plugin_descriptor (
221 static consteval bool type_has_mono_compat_switch (
const Type tt)
229 static constexpr bool
266 static constexpr bool type_can_have_automation (
const Type type)
275 static constexpr bool type_can_have_lanes (
const Type type)
280 template <
typename T>
static consteval Type get_type_for_class ()
282 if constexpr (std::is_same_v<T, MidiTrack>)
284 else if constexpr (std::is_same_v<T, AudioTrack>)
286 else if constexpr (std::is_same_v<T, ChordTrack>)
288 else if constexpr (std::is_same_v<T, InstrumentTrack>)
290 else if constexpr (std::is_same_v<T, AudioBusTrack>)
292 else if constexpr (std::is_same_v<T, MidiBusTrack>)
294 else if constexpr (std::is_same_v<T, MasterTrack>)
296 else if constexpr (std::is_same_v<T, ModulatorTrack>)
298 else if constexpr (std::is_same_v<T, MarkerTrack>)
300 else if constexpr (std::is_same_v<T, FolderTrack>)
302 else if constexpr (std::is_same_v<T, AudioGroupTrack>)
304 else if constexpr (std::is_same_v<T, MidiGroupTrack>)
308 static_assert (utils::dependent_false_v<T>,
"Unknown track type");
314 Q_DISABLE_COPY_MOVE (
Track)
317 enum class TrackFeatures : std::uint8_t
331 std::optional<PortType> in_signal_type,
332 std::optional<PortType> out_signal_type,
333 TrackFeatures enabled_features,
358 AutomationTracklist * automationTracklist ()
const
363 QString name ()
const {
return name_.to_qstring (); }
364 void setName (
const QString &name)
366 const auto name_str = utils::Utf8String::from_qstring (name);
367 if (
name_ == name_str)
371 Q_EMIT nameChanged (name);
373 Q_SIGNAL
void nameChanged (
const QString &name);
375 QColor color ()
const {
return color_.to_qcolor (); }
376 void setColor (
const QColor &color)
378 if (
color_.to_qcolor () == color)
382 Q_EMIT colorChanged (color);
384 Q_SIGNAL
void colorChanged (
const QColor &color);
386 QString comment ()
const {
return comment_.to_qstring (); }
387 void setComment (
const QString &comment)
389 const auto comment_str = utils::Utf8String::from_qstring (comment);
394 Q_EMIT commentChanged (comment);
396 Q_SIGNAL
void commentChanged (
const QString &comment);
398 bool visible ()
const {
return visible_; }
399 void setVisible (
bool visible)
405 Q_EMIT visibleChanged (visible);
407 Q_SIGNAL
void visibleChanged (
bool visible);
409 bool enabled ()
const {
return enabled_; }
410 void setEnabled (
bool enabled)
415 Q_EMIT enabledChanged (enabled);
417 Q_SIGNAL
void enabledChanged (
bool enabled);
420 void setHeight (
double height)
425 height = std::max (
static_cast<double> (Track::MIN_HEIGHT), height);
427 Q_EMIT heightChanged (height);
429 Q_SIGNAL
void heightChanged (
double height);
432 Q_SIGNAL
void fullVisibleHeightChanged ();
434 QString icon ()
const {
return icon_name_.to_qstring (); }
435 void setIcon (
const QString &icon)
437 const auto icon_str = utils::Utf8String::from_qstring (icon);
443 Q_EMIT iconChanged (icon);
445 Q_SIGNAL
void iconChanged (
const QString &icon);
447 Channel * channel ()
const {
return channel_.get (); }
449 plugins::PluginGroup * modulators ()
const {
return modulators_.get (); }
451 TrackLaneList * lanes ()
const {
return lanes_.get (); }
453 dsp::ProcessorParameter * recordingParam ()
const;
454 dsp::ProcessorParameter * monitorParam ()
const;
456 PianoRollTrackMixin * pianoRollTrackMixin ()
const
458 return piano_roll_track_mixin_.get ();
461 bool clipLauncherMode ()
const {
return clip_launcher_mode_; }
462 void setClipLauncherMode (
bool mode);
463 Q_SIGNAL
void clipLauncherModeChanged (
bool mode);
465 dsp::TimebaseProvider * timebaseProvider ()
467 return timebase_provider_.get ();
472 playbackCacheActivityTracker ()
const
474 return playback_cache_activity_tracker_.get ();
493 bool is_copyable ()
const {
return type_is_copyable (
type_); }
494 bool has_automation ()
const {
return automationTracklist () !=
nullptr; }
502 bool multiply_heights (
double multiplier,
bool visible_only,
bool check_only);
511 template <arrangement::ClipObject ClipT>
512 auto generate_name_for_clip (
517 if constexpr (std::is_same_v<ClipT, arrangement::AutomationClip>)
519 assert (automation_track !=
nullptr);
522 "{} - {}",
get_name (), automation_track->parameter ()->label ()));
531 std::vector<ArrangerObjectPtrVariant> &objects)
const;
533 bool contains_uninstantiated_plugin ()
const;
547 uint8_t
get_midi_ch (
const arrangement::MidiClip &midi_clip)
const;
553 collect_plugins (std::vector<plugins::PluginUuidReference> &plugins)
const;
561 static bool is_plugin_descriptor_valid_for_slot_type (
563 zrythm::plugins::PluginSlotType slot_type,
578 auto &get_registry ()
const {
return base_dependencies_.registry_; }
579 auto &get_registry () {
return base_dependencies_.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_.registry_, timebaseProvider ());
602 std::optional<TrackProcessor::FillEventsCallback> fill_events_cb =
604 std::optional<TrackProcessor::TransformMidiInputsFunc>
605 transform_midi_inputs_func = std::nullopt,
606 std::optional<TrackProcessor::AppendMidiInputsToOutputsFunc>
607 append_midi_inputs_to_outputs_func = std::nullopt);
614 std::vector<ArrangerObjectPtrVariant> &objects)
const
619 static constexpr auto kNameKey =
"name"sv;
620 static constexpr auto kIconNameKey =
"iconName"sv;
621 static constexpr auto kVisibleKey =
"visible"sv;
622 static constexpr auto kMainHeightKey =
"mainHeight"sv;
623 static constexpr auto kEnabledKey =
"enabled"sv;
624 static constexpr auto kColorKey =
"color"sv;
625 static constexpr auto kInputSignalTypeKey =
"inSignalType"sv;
626 static constexpr auto kOutputSignalTypeKey =
"outSignalType"sv;
627 static constexpr auto kCommentKey =
"comment"sv;
628 static constexpr auto kFrozenClipIdKey =
"frozenClipId"sv;
629 static constexpr auto kProcessorKey =
"processor"sv;
630 static constexpr auto kAutomationTracklistKey =
"automationTracklist"sv;
631 static constexpr auto kChannelKey =
"channel"sv;
632 static constexpr auto kModulatorsKey =
"modulators"sv;
633 static constexpr auto kModulatorMacroProcessorsKey =
634 "modulatorMacroProcessors"sv;
635 static constexpr auto kPianoRollKey =
"pianoRoll"sv;
636 static constexpr auto kClipLauncherModeKey =
"clipLauncherMode"sv;
637 static constexpr auto kTimebaseKey =
"timebase"sv;
638 friend void to_json (nlohmann::json &j,
const Track &track);
639 friend void from_json (
const nlohmann::json &j, Track &track);
642 make_automation_tracklist ();
648 make_piano_roll_track_mixin ();
655 void init_cache_scheduler ();
672 TrackFeatures features_{};
745 std::vector<utils::QObjectUniquePtr<dsp::ModulatorMacroProcessor>>
758 bool clip_launcher_mode_{};
760 playback_cache_activity_tracker_;
764 BOOST_DESCRIBE_CLASS (
783 piano_roll_track_mixin_,
784 clip_launcher_mode_),