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
49 Q_INVOKABLE bool
50 canRouteTo (const Track * source, const Track * destination) const;
51
55 Q_SIGNAL void routingChanged ();
56
57 // ========================================================================
58
59 void
60 add_or_replace_route (const TrackUuid &source, const TrackUuid &destination);
61 void remove_route_for_source (const TrackUuid &source);
62 void remove_routes_for_destination (const TrackUuid &destination);
63
64 std::optional<TrackUuidReference>
65 get_output_track (const TrackUuid &source) const;
66
67private:
68 static constexpr auto kTrackRoutesKey = "trackRoutes"sv;
69 friend void to_json (nlohmann::json &j, const TrackRouting &t);
70 friend void from_json (const nlohmann::json &j, TrackRouting &t);
71
72private:
73 TrackRegistry &track_registry_;
74
78 std::unordered_map<TrackUuid, TrackUuid> track_routes_;
79};
80} // namespace zrythm::structure::tracks
Q_SIGNAL void routingChanged()
Emitted when a change was made in the routing.
Q_INVOKABLE bool canRouteTo(const Track *source, const Track *destination) const
Checks if source can be routed to destination.
Represents a track in the project.
Definition track.h:54