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 playbackCacheActivityTracker READ playbackCacheActivityTracker CONSTANT)
98 using PluginUuid = plugins::Plugin::
Uuid;
99 using PortType = dsp::PortType;
100 using ArrangerObject = structure::arrangement::ArrangerObject;
101 using ArrangerObjectPtrVariant =
102 structure::arrangement::ArrangerObjectPtrVariant;
105 enum class
Type : uint8_t
171 static constexpr int MIN_HEIGHT = 26;
172 static constexpr int DEF_HEIGHT = 52;
179 case ArrangerObject::Type::AudioRegion:
181 case ArrangerObject::Type::MidiRegion:
183 case ArrangerObject::Type::ChordRegion:
185 case ArrangerObject::Type::AutomationRegion:
188 throw std::runtime_error (
"Invalid region type");
192 static constexpr bool type_is_foldable (
Type type)
198 static constexpr bool type_is_copyable (
Type type)
209 return type_is_copyable (type);
212 static Type type_get_from_plugin_descriptor (
215 static consteval bool type_has_mono_compat_switch (
const Type tt)
223 static constexpr bool
260 static constexpr bool type_can_have_automation (
const Type type)
269 static constexpr bool type_can_have_lanes (
const Type type)
274 template <
typename T>
static consteval Type get_type_for_class ()
276 if constexpr (std::is_same_v<T, MidiTrack>)
278 else if constexpr (std::is_same_v<T, AudioTrack>)
280 else if constexpr (std::is_same_v<T, ChordTrack>)
282 else if constexpr (std::is_same_v<T, InstrumentTrack>)
284 else if constexpr (std::is_same_v<T, AudioBusTrack>)
286 else if constexpr (std::is_same_v<T, MidiBusTrack>)
288 else if constexpr (std::is_same_v<T, MasterTrack>)
290 else if constexpr (std::is_same_v<T, ModulatorTrack>)
292 else if constexpr (std::is_same_v<T, MarkerTrack>)
294 else if constexpr (std::is_same_v<T, FolderTrack>)
296 else if constexpr (std::is_same_v<T, AudioGroupTrack>)
298 else if constexpr (std::is_same_v<T, MidiGroupTrack>)
302 static_assert (utils::dependent_false_v<T>,
"Unknown track type");
308 Q_DISABLE_COPY_MOVE (
Track)
311 enum class TrackFeatures : std::uint8_t
325 std::optional<PortType> in_signal_type,
326 std::optional<PortType> out_signal_type,
327 TrackFeatures enabled_features,
352 AutomationTracklist * automationTracklist ()
const
357 QString name ()
const {
return name_.to_qstring (); }
358 void setName (
const QString &name)
360 const auto name_str = utils::Utf8String::from_qstring (name);
361 if (
name_ == name_str)
365 Q_EMIT nameChanged (name);
367 Q_SIGNAL
void nameChanged (
const QString &name);
369 QColor color ()
const {
return color_.to_qcolor (); }
370 void setColor (
const QColor &color)
372 if (
color_.to_qcolor () == color)
376 Q_EMIT colorChanged (color);
378 Q_SIGNAL
void colorChanged (
const QColor &color);
380 QString comment ()
const {
return comment_.to_qstring (); }
381 void setComment (
const QString &comment)
383 const auto comment_str = utils::Utf8String::from_qstring (comment);
388 Q_EMIT commentChanged (comment);
390 Q_SIGNAL
void commentChanged (
const QString &comment);
392 bool visible ()
const {
return visible_; }
393 void setVisible (
bool visible)
399 Q_EMIT visibleChanged (visible);
401 Q_SIGNAL
void visibleChanged (
bool visible);
403 bool enabled ()
const {
return enabled_; }
404 void setEnabled (
bool enabled)
409 Q_EMIT enabledChanged (enabled);
411 Q_SIGNAL
void enabledChanged (
bool enabled);
414 void setHeight (
double height)
419 height = std::max (
static_cast<double> (Track::MIN_HEIGHT), height);
421 Q_EMIT heightChanged (height);
423 Q_SIGNAL
void heightChanged (
double height);
426 Q_SIGNAL
void fullVisibleHeightChanged ();
428 QString icon ()
const {
return icon_name_.to_qstring (); }
429 void setIcon (
const QString &icon)
431 const auto icon_str = utils::Utf8String::from_qstring (icon);
437 Q_EMIT iconChanged (icon);
439 Q_SIGNAL
void iconChanged (
const QString &icon);
441 Channel * channel ()
const {
return channel_.get (); }
443 plugins::PluginGroup * modulators ()
const {
return modulators_.get (); }
445 TrackLaneList * lanes ()
const {
return lanes_.get (); }
447 dsp::ProcessorParameter * recordingParam ()
const;
448 dsp::ProcessorParameter * monitorParam ()
const;
450 PianoRollTrackMixin * pianoRollTrackMixin ()
const
452 return piano_roll_track_mixin_.get ();
455 bool clipLauncherMode ()
const {
return clip_launcher_mode_; }
456 void setClipLauncherMode (
bool mode);
457 Q_SIGNAL
void clipLauncherModeChanged (
bool mode);
461 playbackCacheActivityTracker ()
const
463 return playback_cache_activity_tracker_.get ();
480 bool is_copyable ()
const {
return type_is_copyable (
type_); }
481 bool has_automation ()
const {
return automationTracklist () !=
nullptr; }
489 bool multiply_heights (
double multiplier,
bool visible_only,
bool check_only);
498 template <arrangement::RegionObject RegionT>
499 auto generate_name_for_region (
500 const RegionT ®ion,
504 if constexpr (std::is_same_v<RegionT, arrangement::AutomationRegion>)
506 assert (automation_track !=
nullptr);
509 "{} - {}",
get_name (), automation_track->parameter ()->label ()));
518 std::vector<ArrangerObjectPtrVariant> &objects)
const;
520 bool contains_uninstantiated_plugin ()
const;
540 collect_plugins (std::vector<plugins::PluginUuidReference> &plugins)
const;
548 static bool is_plugin_descriptor_valid_for_slot_type (
550 zrythm::plugins::PluginSlotType slot_type,
565 auto &get_registry ()
const {
return base_dependencies_.registry_; }
566 auto &get_registry () {
return base_dependencies_.registry_; }
568 TrackProcessor * get_track_processor ()
const {
return processor_.get (); }
570 auto get_icon_name ()
const {
return icon_name_; }
576 void generate_automation_tracks_for_processor (
580 structure::tracks::generate_automation_tracks_for_processor (
581 ats, processor, base_dependencies_.tempo_map_,
582 base_dependencies_.registry_);
589 std::optional<TrackProcessor::FillEventsCallback> fill_events_cb =
591 std::optional<TrackProcessor::TransformMidiInputsFunc>
592 transform_midi_inputs_func = std::nullopt,
593 std::optional<TrackProcessor::AppendMidiInputsToOutputsFunc>
594 append_midi_inputs_to_outputs_func = std::nullopt);
601 std::vector<ArrangerObjectPtrVariant> &objects)
const
606 static constexpr auto kNameKey =
"name"sv;
607 static constexpr auto kIconNameKey =
"iconName"sv;
608 static constexpr auto kVisibleKey =
"visible"sv;
609 static constexpr auto kMainHeightKey =
"mainHeight"sv;
610 static constexpr auto kEnabledKey =
"enabled"sv;
611 static constexpr auto kColorKey =
"color"sv;
612 static constexpr auto kInputSignalTypeKey =
"inSignalType"sv;
613 static constexpr auto kOutputSignalTypeKey =
"outSignalType"sv;
614 static constexpr auto kCommentKey =
"comment"sv;
615 static constexpr auto kFrozenClipIdKey =
"frozenClipId"sv;
616 static constexpr auto kProcessorKey =
"processor"sv;
617 static constexpr auto kAutomationTracklistKey =
"automationTracklist"sv;
618 static constexpr auto kChannelKey =
"channel"sv;
619 static constexpr auto kModulatorsKey =
"modulators"sv;
620 static constexpr auto kModulatorMacroProcessorsKey =
621 "modulatorMacroProcessors"sv;
622 static constexpr auto kPianoRollKey =
"pianoRoll"sv;
623 static constexpr auto kClipLauncherModeKey =
"clipLauncherMode"sv;
624 friend void to_json (nlohmann::json &j,
const Track &track);
625 friend void from_json (
const nlohmann::json &j,
Track &track);
628 make_automation_tracklist ();
634 make_piano_roll_track_mixin ();
641 void init_cache_scheduler ();
658 TrackFeatures features_{};
731 std::vector<utils::QObjectUniquePtr<dsp::ModulatorMacroProcessor>>
744 bool clip_launcher_mode_{};
746 playback_cache_activity_tracker_;
748 BOOST_DESCRIBE_CLASS (
767 piano_roll_track_mixin_,
768 clip_launcher_mode_),