Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
track.h
1// SPDX-FileCopyrightText: © 2018-2022, 2024-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/modulator_macro_processor.h"
7#include "structure/tracks/automation_tracklist.h"
8#include "structure/tracks/channel.h"
9#include "structure/tracks/piano_roll_track.h"
10#include "structure/tracks/playback_cache_activity_tracker.h"
11#include "structure/tracks/recordable_track.h"
12#include "structure/tracks/track_fwd.h"
13#include "structure/tracks/track_lane_list.h"
14#include "structure/tracks/track_processor.h"
15#include "utils/playback_cache_scheduler.h"
16
17#include <QColor>
18#include <QtQmlIntegration/qqmlintegration.h>
19
20namespace zrythm::dsp
21{
22class MidiPlaybackCache;
23class TempoMapWrapper;
24}
25
26namespace zrythm::structure::tracks
27{
28using SoloedTracksExistGetter = std::function<bool ()>;
29
31{
32 const dsp::TempoMapWrapper &tempo_map_;
33 dsp::FileAudioSourceRegistry &file_audio_source_registry_;
34 plugins::PluginRegistry &plugin_registry_;
35 dsp::PortRegistry &port_registry_;
36 dsp::ProcessorParameterRegistry &param_registry_;
37 arrangement::ArrangerObjectRegistry &obj_registry_;
38 const dsp::ITransport &transport_;
39 SoloedTracksExistGetter soloed_tracks_exist_getter_;
40};
41
53class Track : public QObject, public utils::UuidIdentifiableObject<Track>
54{
55 Q_OBJECT
56 Q_PROPERTY (Type type READ type CONSTANT)
57 Q_PROPERTY (
58 zrythm::structure::tracks::AutomationTracklist * automationTracklist READ
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)
62 Q_PROPERTY (
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)
69 Q_PROPERTY (
70 double fullVisibleHeight READ fullVisibleHeight NOTIFY
71 fullVisibleHeightChanged)
72 Q_PROPERTY (zrythm::structure::tracks::Channel * channel READ channel CONSTANT)
73 Q_PROPERTY (zrythm::plugins::PluginGroup * modulators READ modulators CONSTANT)
74 Q_PROPERTY (
75 zrythm::structure::tracks::TrackLaneList * lanes READ lanes CONSTANT)
76 Q_PROPERTY (
77 zrythm::structure::tracks::RecordableTrackMixin * recordableTrackMixin READ
78 recordableTrackMixin CONSTANT)
79 Q_PROPERTY (
80 zrythm::structure::tracks::PianoRollTrackMixin * pianoRollTrackMixin READ
81 pianoRollTrackMixin CONSTANT)
82 Q_PROPERTY (
83 bool clipLauncherMode READ clipLauncherMode WRITE setClipLauncherMode NOTIFY
84 clipLauncherModeChanged)
85 Q_PROPERTY (
87 playbackCacheActivityTracker READ playbackCacheActivityTracker CONSTANT)
88 QML_ELEMENT
89 QML_UNCREATABLE ("")
90public:
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;
100 using Color = utils::Color;
101
102 enum class Type : uint8_t
103 {
109
114 Audio,
115
119 Master,
120
125 Chord,
126
130 Marker,
131
136
142 AudioBus,
143
152
155 Midi,
156
158 MidiBus,
159
161 MidiGroup,
162
164 Folder,
165 };
166 Q_ENUM (Type)
167
168 static constexpr int MIN_HEIGHT = 26;
169 static constexpr int DEF_HEIGHT = 52;
170
171 static bool
172 type_can_have_region_type (Type type, ArrangerObject::Type region_type)
173 {
174 switch (region_type)
175 {
176 case ArrangerObject::Type::AudioRegion:
177 return type == Type::Audio;
178 case ArrangerObject::Type::MidiRegion:
179 return type == Type::Midi || type == Type::Instrument;
180 case ArrangerObject::Type::ChordRegion:
181 return type == Type::Chord;
182 case ArrangerObject::Type::AutomationRegion:
183 return true;
184 default:
185 throw std::runtime_error ("Invalid region type");
186 }
187 }
188
189 static constexpr bool type_is_foldable (Type type)
191 return type == Type::Folder || type == Type::AudioGroup
192 || type == Type::MidiGroup;
193 }
194
195 static constexpr bool type_is_copyable (Type type)
196 {
197 return type != Type::Master && type != Type::Chord
198 && type != Type::Modulator && type != Type::Marker;
199 }
200
204 static constexpr bool type_is_deletable (Type type)
205 {
206 return type_is_copyable (type);
208
209 static Type type_get_from_plugin_descriptor (
211
212 static consteval bool type_has_mono_compat_switch (const Type tt)
213 {
214 return tt == Type::AudioGroup || tt == Type::Master;
215 }
216
217 /**
218 * Returns if regions in tracks from @p type1 can be moved to @p type2.
219 */
220 static constexpr bool
221 type_is_compatible_for_moving (const Type type1, const Type type2)
222 {
223 return type1 == type2 || (type1 == Type::Midi && type2 == Type::Instrument)
224 || (type1 == Type::Instrument && type2 == Type::Midi);
226
229
230 [[gnu::const]]
231 static constexpr bool type_has_piano_roll (const Type type)
232 {
233 return type == Type::Midi || type == Type::Instrument;
234 }
235
237 * Returns if the Track should have an inputs selector.
238 */
239 static constexpr bool type_has_inputs (const Type type)
240 {
241 return type == Type::Midi || type == Type::Instrument || type == Type::Audio;
242 }
243
251 static constexpr bool type_can_be_group_target (const Type type)
252 {
253 return type == Type::AudioGroup || type == Type::MidiGroup
254 || type == Type::Instrument || type == Type::Master;
255 }
256
257 static constexpr bool type_can_have_automation (const Type type)
258 {
259 return type == Type::Instrument || type == Type::Audio
260 || type == Type::Master || type == Type::Chord
261 || type == Type::Modulator || type == Type::AudioBus
262 || type == Type::AudioGroup || type == Type::Midi
263 || type == Type::MidiBus || type == Type::MidiGroup;
264 }
265
266 static constexpr bool type_can_have_lanes (const Type type)
267 {
268 return type == Type::Instrument || type == Type::Audio || type == Type::Midi;
269 }
270
271 template <typename T> static consteval Type get_type_for_class ()
272 {
273 if constexpr (std::is_same_v<T, MidiTrack>)
274 return Type::Midi;
275 else if constexpr (std::is_same_v<T, AudioTrack>)
276 return Type::Audio;
277 else if constexpr (std::is_same_v<T, ChordTrack>)
278 return Type::Chord;
279 else if constexpr (std::is_same_v<T, InstrumentTrack>)
280 return Type::Instrument;
281 else if constexpr (std::is_same_v<T, AudioBusTrack>)
282 return Type::AudioBus;
283 else if constexpr (std::is_same_v<T, MidiBusTrack>)
284 return Type::MidiBus;
285 else if constexpr (std::is_same_v<T, MasterTrack>)
286 return Type::Master;
287 else if constexpr (std::is_same_v<T, ModulatorTrack>)
288 return Type::Modulator;
289 else if constexpr (std::is_same_v<T, MarkerTrack>)
290 return Type::Marker;
291 else if constexpr (std::is_same_v<T, FolderTrack>)
292 return Type::Folder;
293 else if constexpr (std::is_same_v<T, AudioGroupTrack>)
294 return Type::AudioGroup;
295 else if constexpr (std::is_same_v<T, MidiGroupTrack>)
296 return Type::MidiGroup;
297 else
298 {
299 static_assert (dependent_false_v<T>, "Unknown track type");
300 }
301 }
302
303public:
304 ~Track () override;
305 Q_DISABLE_COPY_MOVE (Track)
307protected:
308 enum class TrackFeatures : std::uint8_t
309 {
310 Modulators = 1 << 0,
311 Automation = 1 << 1,
312 Lanes = 1 << 2,
313 Recording = 1 << 3,
314 PianoRoll = 1 << 4,
315 };
316
320 Track (
321 Type type,
322 std::optional<PortType> in_signal_type,
323 std::optional<PortType> out_signal_type,
324 TrackFeatures enabled_features,
325 BaseTrackDependencies dependencies);
326
327public:
328 bool has_piano_roll () const { return type_has_piano_roll (type_); }
329
330 bool is_folder () const { return type_ == Type::Folder; }
331 bool is_audio_group () const { return type_ == Type::AudioGroup; }
332 bool is_midi_group () const { return type_ == Type::MidiGroup; }
333 bool is_audio_bus () const { return type_ == Type::AudioBus; }
334 bool is_midi_bus () const { return type_ == Type::MidiBus; }
335 bool is_modulator () const { return type_ == Type::Modulator; }
336 bool is_chord () const { return type_ == Type::Chord; }
337 bool is_marker () const { return type_ == Type::Marker; }
338 bool is_audio () const { return type_ == Type::Audio; }
339 bool is_instrument () const { return type_ == Type::Instrument; }
340 bool is_midi () const { return type_ == Type::Midi; }
341 bool is_master () const { return type_ == Type::Master; }
342
343 // ========================================================================
344 // QML Interface
345 // ========================================================================
346
347 Type type () const { return type_; }
348
349 AutomationTracklist * automationTracklist () const
350 {
351 return automation_tracklist_.get ();
352 }
353
354 QString name () const { return name_.to_qstring (); }
355 void setName (const QString &name)
356 {
357 const auto name_str = utils::Utf8String::from_qstring (name);
358 if (name_ == name_str)
359 return;
360
361 name_ = name_str;
362 Q_EMIT nameChanged (name);
363 }
364 Q_SIGNAL void nameChanged (const QString &name);
365
366 QColor color () const { return color_.to_qcolor (); }
367 void setColor (const QColor &color)
368 {
369 if (color_.to_qcolor () == color)
370 return;
371
372 color_ = color;
373 Q_EMIT colorChanged (color);
374 }
375 Q_SIGNAL void colorChanged (const QColor &color);
376
377 QString comment () const { return comment_.to_qstring (); }
378 void setComment (const QString &comment)
379 {
380 const auto comment_str = utils::Utf8String::from_qstring (comment);
381 if (comment_ == comment_str)
382 return;
383
384 comment_ = comment_str;
385 Q_EMIT commentChanged (comment);
386 }
387 Q_SIGNAL void commentChanged (const QString &comment);
388
389 bool visible () const { return visible_; }
390 void setVisible (bool visible)
391 {
392 if (visible_ == visible)
393 return;
394
395 visible_ = visible;
396 Q_EMIT visibleChanged (visible);
397 }
398 Q_SIGNAL void visibleChanged (bool visible);
399
400 bool enabled () const { return enabled_; }
401 void setEnabled (bool enabled)
402 {
403 if (enabled_ == enabled)
404 return;
405 enabled_ = enabled;
406 Q_EMIT enabledChanged (enabled);
407 }
408 Q_SIGNAL void enabledChanged (bool enabled);
409
410 double height () const { return main_height_; }
411 void setHeight (double height)
412 {
414 return;
415
416 height = std::max (static_cast<double> (Track::MIN_HEIGHT), height);
417 main_height_ = height;
418 Q_EMIT heightChanged (height);
419 }
420 Q_SIGNAL void heightChanged (double height);
421
422 double fullVisibleHeight () const { return get_full_visible_height (); }
423 Q_SIGNAL void fullVisibleHeightChanged ();
424
425 QString icon () const { return icon_name_.to_qstring (); }
426 void setIcon (const QString &icon)
427 {
428 const auto icon_str = utils::Utf8String::from_qstring (icon);
429 if (icon_name_ == icon_str)
430 {
431 return;
432 }
433 icon_name_ = icon_str;
434 Q_EMIT iconChanged (icon);
435 }
436 Q_SIGNAL void iconChanged (const QString &icon);
437
438 Channel * channel () const { return channel_.get (); }
439
440 plugins::PluginGroup * modulators () const { return modulators_.get (); }
441
442 TrackLaneList * lanes () const { return lanes_.get (); }
443
444 RecordableTrackMixin * recordableTrackMixin () const
445 {
446 return recordable_track_mixin_.get ();
447 }
448
449 PianoRollTrackMixin * pianoRollTrackMixin () const
450 {
451 return piano_roll_track_mixin_.get ();
452 }
453
454 bool clipLauncherMode () const { return clip_launcher_mode_; }
455 void setClipLauncherMode (bool mode);
456 Q_SIGNAL void clipLauncherModeChanged (bool mode);
457
458 // cache activity tracking
459 [[nodiscard]] PlaybackCacheActivityTracker *
460 playbackCacheActivityTracker () const
461 {
462 return playback_cache_activity_tracker_.get ();
463 }
464
471 Q_INVOKABLE void
473
474 // ========================================================================
475
476 // bool has_lanes () const { return type_has_lanes (type_); }
477
478 bool is_deletable () const { return type_is_deletable (type_); }
479 bool is_copyable () const { return type_is_copyable (type_); }
480 bool has_automation () const { return automationTracklist () != nullptr; }
486 double get_full_visible_height () const;
487
488 bool multiply_heights (double multiplier, bool visible_only, bool check_only);
489
490 bool can_be_group_target () const { return type_can_be_group_target (type_); }
491
495 void set_default_name ();
496
497 template <arrangement::RegionObject RegionT>
498 auto generate_name_for_region (
499 const RegionT &region,
500 AutomationTrack * automation_track = nullptr)
501 {
502 auto ret = get_name ();
503 if constexpr (std::is_same_v<RegionT, arrangement::AutomationRegion>)
504 {
505 assert (automation_track != nullptr);
507 fmt::format (
508 "{} - {}", get_name (), automation_track->parameter ()->label ()));
509 }
510 return ret;
511 }
512
517 std::vector<ArrangerObjectPtrVariant> &objects) const;
518
519 bool contains_uninstantiated_plugin () const;
520
524 utils::Utf8String get_name () const { return name_; };
525
526 auto input_signal_type () const { return in_signal_type_; }
527 auto output_signal_type () const { return out_signal_type_; }
528
533 uint8_t get_midi_ch (const arrangement::MidiRegion &midi_region) const;
534
538 void collect_plugins (std::vector<plugins::PluginPtrVariant> &plugins) const;
539
540// TODO
541#if 0
546 static bool is_plugin_descriptor_valid_for_slot_type (
548 zrythm::plugins::PluginSlotType slot_type,
549 Track::Type track_type);
550#endif
551
552 utils::Utf8String get_full_designation_for_port (const dsp::Port &port) const;
553
562
563 auto &get_plugin_registry () const
564 {
565 return base_dependencies_.plugin_registry_;
566 }
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
571 {
572 return base_dependencies_.param_registry_;
573 }
574 auto &get_param_registry () { return base_dependencies_.param_registry_; }
575 auto &get_object_registry () const
576 {
577 return base_dependencies_.obj_registry_;
578 }
579 auto &get_object_registry () { return base_dependencies_.obj_registry_; }
580
581 TrackProcessor * get_track_processor () const { return processor_.get (); }
582
583 auto get_icon_name () const { return icon_name_; }
584
585protected:
586 friend void
587 init_from (Track &obj, const Track &other, utils::ObjectCloneType clone_type);
589 void generate_automation_tracks_for_processor (
591 const dsp::ProcessorBase &processor)
592 {
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_);
597 }
598
600 * @brief Implementations with a processor must call this in their constructor.
601 */
603 std::optional<TrackProcessor::FillEventsCallback> fill_events_cb =
604 std::nullopt,
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);
609
615 std::vector<ArrangerObjectPtrVariant> &objects) const
616 {
617 }
618
619private:
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);
641
643 make_automation_tracklist ();
644 [[nodiscard]] utils::QObjectUniquePtr<Channel> make_channel ();
646 make_modulators ();
647 [[nodiscard]] utils::QObjectUniquePtr<TrackLaneList> make_lanes ();
649 make_recordable_track_mixin ();
651 make_piano_roll_track_mixin ();
652
658 void init_cache_scheduler ();
667 void init_playback_cache_activity_tracker (TrackProcessor &proc);
668
669protected:
670 BaseTrackDependencies base_dependencies_;
671
674
675 TrackFeatures features_{};
676
679
682
684 bool visible_ = true;
685
687 double main_height_{ DEF_HEIGHT };
695 bool enabled_ = true;
696
702 Color color_;
703
707 std::optional<PortType> in_signal_type_;
712 std::optional<PortType> out_signal_type_;
716
722 std::optional<dsp::FileAudioSourceUuidReference> frozen_clip_id_;
738
743
746
748 std::vector<utils::QObjectUniquePtr<dsp::ModulatorMacroProcessor>>
750
752
753 utils::QObjectUniquePtr<RecordableTrackMixin> recordable_track_mixin_;
754
755 utils::QObjectUniquePtr<PianoRollTrackMixin> piano_roll_track_mixin_;
756
762
763 bool clip_launcher_mode_{};
765 playback_cache_activity_tracker_;
766
767 BOOST_DESCRIBE_CLASS (
768 Track,
770 (),
771 (type_,
772 name_,
773 visible_,
775 enabled_,
776 color_,
779 comment_,
782 channel_,
785 lanes_,
786 recordable_track_mixin_,
787 piano_roll_track_mixin_,
788 clip_launcher_mode_),
789 ())
790};
791
793using TrackRegistryRef = std::reference_wrapper<TrackRegistry>;
794using TrackUuidReference = utils::UuidReference<TrackRegistry>;
795
796struct FinalTrackDependencies : public BaseTrackDependencies
797{
798 FinalTrackDependencies (
799 const dsp::TempoMapWrapper &tempo_map,
800 dsp::FileAudioSourceRegistry &file_audio_source_registry,
801 plugins::PluginRegistry &plugin_registry,
802 dsp::PortRegistry &port_registry,
803 dsp::ProcessorParameterRegistry &param_registry,
804 arrangement::ArrangerObjectRegistry &obj_registry,
805 TrackRegistry &track_registry,
806 const dsp::ITransport &transport,
807 SoloedTracksExistGetter soloed_tracks_exist_getter)
809 tempo_map,
810 file_audio_source_registry,
811 plugin_registry,
812 port_registry,
813 param_registry,
814 obj_registry,
815 transport,
816 std::move (soloed_tracks_exist_getter)),
817 track_registry_ (track_registry)
818 {
819 }
820
821 TrackRegistry &track_registry_;
822
823 BaseTrackDependencies to_base_dependencies ()
824 {
825 return static_cast<BaseTrackDependencies> (*this); // NOLINT
826 }
827};
828
829} // namespace zrythm::structure::tracks
Interface for transport.
Definition itransport.h:16
A base class for ports used for connecting processors in the DSP graph.
Definition port.h:29
A base class for processors in the DSP graph.
Wrapper over a Uuid registry that provides (slow) lookup by unique ID.
Definition parameter.h:449
The PluginDescriptor class provides a set of static utility functions and member functions to work wi...
A flexible container for plugins and nested plugin groups.
A container that manages a list of automation tracks.
Represents a channel strip on the mixer.
Definition channel.h:57
Mixin for a piano roll-based track.
Helper that manages cache activity state for a cache-holding object.
Mixin class for a track that can record events (excluding automation).
A TrackProcessor is a standalone processor that is used as the first step when processing a track in ...
Represents a track in the project.
Definition track.h:54
Track(Type type, std::optional< PortType > in_signal_type, std::optional< PortType > out_signal_type, TrackFeatures enabled_features, BaseTrackDependencies dependencies)
Constructor to be used by subclasses.
utils::QObjectUniquePtr< plugins::PluginGroup > modulators_
Modulators.
Definition track.h:731
static constexpr bool type_has_inputs(const Type type)
Returns if the Track should have an inputs selector.
Definition track.h:225
uint8_t get_midi_ch(const arrangement::MidiRegion &midi_region) const
Returns the MIDI channel that this region should be played on, starting from 1.
utils::QObjectUniquePtr< TrackProcessor > processor_
The TrackProcessor, used for processing.
Definition track.h:723
bool enabled_
Active (enabled) or not.
Definition track.h:681
std::optional< dsp::FileAudioSourceUuidReference > frozen_clip_id_
Pool ID of the clip if track is frozen (unset if not frozen).
Definition track.h:708
utils::Utf8String name_
Track name, used in channel too.
Definition track.h:664
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.
Definition track.h:207
void generate_basic_automation_tracks()
Adds basic automation tracks.
double main_height_
Height of the main part (without lanes).
Definition track.h:673
static constexpr bool type_has_piano_roll(const Type type)
Returns if the Track should have a piano roll.
Definition track.h:217
std::optional< PortType > in_signal_type_
The input signal type (eg audio bus tracks have audio input signals).
Definition track.h:693
utils::Utf8String get_name() const
Getter for the track name.
Definition track.h:510
utils::QObjectUniquePtr< utils::PlaybackCacheScheduler > playable_content_cache_request_debouncer_
Debouncer/scheduler of audio/MIDI cache requests.
Definition track.h:747
utils::QObjectUniquePtr< AutomationTracklist > automation_tracklist_
Automation tracks, if track is automatable.
Definition track.h:713
Type type_
The type of track this is.
Definition track.h:659
utils::Utf8String comment_
User comments.
Definition track.h:701
utils::QObjectUniquePtr< Channel > channel_
Channel for this track, if any.
Definition track.h:728
std::optional< PortType > out_signal_type_
The output signal type (eg midi tracks have MIDI output signals).
Definition track.h:698
void set_default_name()
Sets a default name for this track (based on its type).
@ Marker
Marker Track's contain named markers at specific Position's in the song.
Definition track.h:116
@ AudioGroup
Group Tracks are used for grouping audio signals, for example routing multiple drum tracks to a "Drum...
Definition track.h:135
@ AudioBus
Buses are channels that receive audio input and have effects on their channel strip.
Definition track.h:128
@ Modulator
Special track to contain global Modulator's.
Definition track.h:121
@ Midi
Midi tracks can only have MIDI effects in the strip and produce MIDI output that can be routed to ins...
Definition track.h:141
@ Instrument
Instrument tracks must have an Instrument plugin at the first slot and they produce audio output.
Definition track.h:94
@ Folder
Foldable track used for visual grouping.
Definition track.h:150
@ Audio
Audio tracks can record and contain audio clips.
Definition track.h:100
@ MidiGroup
Same with audio group but for MIDI signals.
Definition track.h:147
@ MidiBus
Same with audio bus but for MIDI signals.
Definition track.h:144
@ Chord
The chord track contains chords that can be used to modify midi in real time or to color the piano ro...
Definition track.h:111
@ Master
The master track is a special type of group track.
Definition track.h:105
utils::QObjectUniquePtr< TrackProcessor > make_track_processor(std::optional< TrackProcessor::FillEventsCallback > fill_events_cb=std::nullopt, std::optional< TrackProcessor::TransformMidiInputsFunc > transform_midi_inputs_func=std::nullopt, std::optional< TrackProcessor::AppendMidiInputsToOutputsFunc > append_midi_inputs_to_outputs_func=std::nullopt)
Implementations with a processor must call this in their constructor.
std::vector< utils::QObjectUniquePtr< dsp::ModulatorMacroProcessor > > modulator_macro_processors_
Modulator macros.
Definition track.h:735
double get_full_visible_height() const
Returns the full visible height (main height + height of all visible automation tracks + height of al...
virtual void collect_additional_timeline_objects(std::vector< ArrangerObjectPtrVariant > &objects) const
Called by collect_timeline_objects to collect any additional objects not handled by this class (such ...
Definition track.h:600
static constexpr bool type_is_deletable(Type type)
Returns whether a track of the given type should be deletable by the user.
Definition track.h:190
Color color_
Track color.
Definition track.h:688
void collect_plugins(std::vector< plugins::PluginPtrVariant > &plugins) const
Fills in the given array with all plugins in the track.
bool visible_
Whole Track is visible or not.
Definition track.h:670
void collect_timeline_objects(std::vector< ArrangerObjectPtrVariant > &objects) const
Appends all the timeine objects in the track to objects.
Q_INVOKABLE void regeneratePlaybackCaches(utils::ExpandableTickRange affectedRange)
To be connected to to notify of any changes to the playable content, like MIDI or audio events.
utils::Utf8String icon_name_
Icon name of the track.
Definition track.h:667
static constexpr bool type_can_be_group_target(const Type type)
Returns if the Track can be a direct route target.
Definition track.h:237
A registry that owns and manages objects identified by a UUID.
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:36
Lightweight UTF-8 string wrapper with safe conversions.
Definition utf8_string.h:37
static constexpr Utf8String from_utf8_encoded_string(std::string_view str)
Construct from a std::string_view that we are 100% sure is UTF8-encoded.
Definition utf8_string.h:80
Base class for objects that need to be uniquely identified by UUID.
A reference-counted RAII wrapper for a UUID in a registry.
String utilities.
constexpr bool values_equal_for_qproperty_type(const T &a, const T &b)
Helper that checks if 2 values are equal.
Definition qt.h:18