Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
group_target_track.h
1
2// SPDX-FileCopyrightText: © 2020-2022, 2025 Alexandros Theodotou <alex@zrythm.org>
3// SPDX-License-Identifier: LicenseRef-ZrythmLicense
4
5#pragma once
6
7#include "structure/tracks/channel_track.h"
8
9namespace zrythm::structure::tracks
10{
17class GroupTargetTrack : virtual public ChannelTrack
18{
19protected:
20 GroupTargetTrack () noexcept { }
21
22public:
23 ~GroupTargetTrack () override = default;
24 Z_DISABLE_COPY_MOVE (GroupTargetTrack)
25
26
31 virtual void update_children () final;
32
36 virtual void remove_child (
37 Track::Uuid child_id,
38 bool disconnect,
39 bool recalc_graph,
40 bool pub_events) final;
41
47 void
48 remove_all_children (bool disconnect, bool recalc_graph, bool pub_events);
49
55 void add_child (
56 Track::Uuid child_id,
57 bool connect,
58 bool recalc_graph,
59 bool pub_events);
60
61 void add_children (
62 std::span<const Track::Uuid> children,
63 bool connect,
64 bool recalc_graph,
65 bool pub_events);
66
70 int find_child (Track::Uuid track_name_hash);
71
72protected:
73 friend void init_from (
74 GroupTargetTrack &obj,
75 const GroupTargetTrack &other,
76 utils::ObjectCloneType clone_type);
77
78private:
79 static constexpr auto kChildrenKey = "children"sv;
80 friend void to_json (nlohmann::json &j, const GroupTargetTrack &track)
81 {
82 j[kChildrenKey] = track.children_;
83 }
84 friend void from_json (const nlohmann::json &j, GroupTargetTrack &track)
85 {
86 j.at (kChildrenKey).get_to (track.children_);
87 }
88
92 static void update_child_output (
93 ChannelTrack &ch_track,
94 GroupTargetTrack * output,
95 bool recalc_graph,
96 bool pub_events);
97
98 bool contains_child (Track::Uuid child_name_hash);
99
100public:
106 std::vector<Track::Uuid> children_;
107};
108
109}
Abstract base class for a track that can be routed to.
virtual void remove_child(Track::Uuid child_id, bool disconnect, bool recalc_graph, bool pub_events) final
Removes a child track from the list of children.
void add_child(Track::Uuid child_id, bool connect, bool recalc_graph, bool pub_events)
Adds a child track to the list of children.
int find_child(Track::Uuid track_name_hash)
Returns the index of the child matching the given hash.
std::vector< Track::Uuid > children_
Name hashes of tracks that are routed to this track, if group track.
virtual void update_children() final
Updates the track's children.
void remove_all_children(bool disconnect, bool recalc_graph, bool pub_events)
Remove all known children.
Represents a track in the project.
Definition track.h:362
String utilities.
Definition algorithms.h:12