Zrythm v2.0.0-alpha.1+31.4967fd053471
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
zrythm::dsp::PortObservationManager Class Reference

Manages port observer lifecycle and runs a drain timer. More...

#include <src/dsp/port_observation_manager.h>

Inheritance diagram for zrythm::dsp::PortObservationManager:
Collaboration diagram for zrythm::dsp::PortObservationManager:

Public Types

using RegistrationId = int

Signals

void observationChanged ()

Public Member Functions

 PortObservationManager (utils::IObjectRegistry &registry, QObject *parent=nullptr)
RegistrationId register_request (const Port &port)
void unregister_request (RegistrationId id)
PortObservationCachecache (RegistrationId id)
PortObserverget_observer (const Port &port) const
std::span< PortObserver *const > observers () const
void drain_all ()

Detailed Description

Manages port observer lifecycle and runs a drain timer.

Owned by Project. UI components create ObservationToken instances to request observation of a port. The manager creates/removes PortObserver instances based on ref counts and emits observationChanged() to trigger graph rebuilds.

A 60fps drain timer consuming-reads from observer ring buffers into per-requester caches on the UI thread.

Thread safety
All register/unregister calls and drain_all() run on the Qt event loop (main thread). observationChanged() is emitted from the same thread, and the Engine connects it to a graph rebuild that pauses processing first. Therefore, observers() is never read concurrently with writes — the pause-before-rebuild ordering is guaranteed by the signal/slot delivery mechanism. This contract must be preserved: if tokens are ever created or destroyed from a non-main thread, a mutex will be required.

Definition at line 42 of file port_observation_manager.h.

Member Typedef Documentation

◆ RegistrationId

using zrythm::dsp::PortObservationManager::RegistrationId = int

Definition at line 49 of file port_observation_manager.h.


The documentation for this class was generated from the following file: