Zrythm v2.0.0-alpha.1+31.4967fd053471
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
port_observation_manager.h
1// SPDX-FileCopyrightText: © 2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <memory>
7#include <span>
8#include <unordered_map>
9#include <vector>
10
11#include "dsp/port.h"
12
13#include <QObject>
14#include <QtQmlIntegration/qqmlintegration.h>
15
16namespace zrythm::dsp
17{
18
19class PortObserver;
21
42class PortObservationManager : public QObject
43{
44 Q_OBJECT
45 QML_ELEMENT
46 QML_UNCREATABLE ("")
47
48public:
49 using RegistrationId = int;
50
51 PortObservationManager (
52 utils::IObjectRegistry &registry,
53 QObject * parent = nullptr);
54
55 ~PortObservationManager () override;
56
57 Q_DISABLE_COPY_MOVE (PortObservationManager)
58
59 // Called by ObservationToken on construction/destruction
60 RegistrationId register_request (const Port &port);
61 void unregister_request (RegistrationId id);
62
63 // Cache access for registered requesters
64 PortObservationCache &cache (RegistrationId id);
65
66 // Called by graph builder during build
67 PortObserver * get_observer (const Port &port) const;
68
69 // Called by graph builder during build
70 std::span<PortObserver * const> observers () const;
71
72 // For testing — manually triggers drain
73 void drain_all ();
74
75Q_SIGNALS:
76 void observationChanged ();
77
78private:
79 PortObserver * find_observer_by_uuid (const PortUuid &port_uuid) const;
80
81 struct Impl;
82 std::unique_ptr<Impl> impl_;
83};
84
85}
Pure data-capture graph node that observes a port's output.
A base class for ports used for connecting processors in the DSP graph.
Definition port.h:37
Abstract interface for a UUID-keyed object registry.
Per-requester cache for drained observation data.