Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
track_routing.h
1// SPDX-FileCopyrightText: © 2025-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "structure/tracks/track.h"
7
8namespace zrythm::structure::tracks
9{
13class TrackRouting : public QObject
14{
15 Q_OBJECT
16 QML_ELEMENT
17 QML_UNCREATABLE ("")
18public:
19 TrackRouting (TrackRegistry &track_registry, QObject * parent = nullptr);
20
21 // ========================================================================
22 // QML Interface
23 // ========================================================================
24
25 Q_INVOKABLE QVariant getOutputTrack (const Track * source) const;
26
27 Q_INVOKABLE void
28 setOutputTrack (const Track * source, const Track * destination);
29
33 Q_SIGNAL void routingChanged ();
34
35 // ========================================================================
36
37 void
38 add_or_replace_route (const TrackUuid &source, const TrackUuid &destination);
39 void remove_route_for_source (const TrackUuid &source);
40 void remove_routes_for_destination (const TrackUuid &destination);
41
42 std::optional<TrackUuidReference>
43 get_output_track (const TrackUuid &source) const;
44
45private:
46 static constexpr auto kTrackRoutesKey = "trackRoutes"sv;
47 friend void to_json (nlohmann::json &j, const TrackRouting &t);
48 friend void from_json (const nlohmann::json &j, TrackRouting &t);
49
50private:
51 TrackRegistry &track_registry_;
52
56 std::unordered_map<TrackUuid, TrackUuid> track_routes_;
57};
58} // namespace zrythm::structure::tracks
Q_SIGNAL void routingChanged()
Emitted when a change was made in the routing.
Represents a track in the project.
Definition track.h:54