Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
control_room.h
1// SPDX-FileCopyrightText: © 2019-2021, 2024-2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/fader.h"
7#include "structure/tracks/track_fwd.h"
8
9#include <boost/unordered/unordered_flat_map_fwd.hpp>
10
11namespace zrythm::engine::session
12{
13
22class ControlRoom : public QObject
23{
24 Q_OBJECT
25 Q_PROPERTY (
26 bool dimOutput READ dimOutput WRITE setDimOutput NOTIFY dimOutputChanged)
27 Q_PROPERTY (
28 zrythm::dsp::ProcessorParameter * muteVolume READ muteVolume CONSTANT)
29 Q_PROPERTY (
30 zrythm::dsp::ProcessorParameter * listenVolume READ muteVolume CONSTANT)
31 Q_PROPERTY (
32 zrythm::dsp::ProcessorParameter * dimVolume READ muteVolume CONSTANT)
33 Q_PROPERTY (zrythm::dsp::Fader * monitorFader READ monitorFader CONSTANT)
34 QML_ELEMENT
35 QML_UNCREATABLE ("")
36
37public:
38 using RealtimeTracks = boost::unordered_flat_map<
39 structure::tracks::TrackUuid,
40 structure::tracks::TrackPtrVariant>;
41 using RealtimeTracksProvider = std::function<const RealtimeTracks &()>;
42
43 ControlRoom (
44 RealtimeTracksProvider rt_tracks_provider,
45 QObject * parent = nullptr);
46
47 // ========================================================================
48 // QML Interface
49 // ========================================================================
50
51 bool dimOutput () const { return dim_output_.load (); }
52 void setDimOutput (bool dim)
53 {
54 bool expected = !dim;
55 if (dim_output_.compare_exchange_strong (expected, dim))
56 {
57 Q_EMIT dimOutputChanged (dim);
58 }
59 }
60 Q_SIGNAL void dimOutputChanged (bool dim);
61
62 dsp::ProcessorParameter * muteVolume () const { return mute_volume_.get (); }
63 dsp::ProcessorParameter * listenVolume () const
64 {
65 return listen_volume_.get ();
66 }
67 dsp::ProcessorParameter * dimVolume () const { return dim_volume_.get (); }
68 auto * monitorFader () const { return monitor_fader_.get (); }
69
70 // ========================================================================
71
72private:
76 dsp::PortRegistry port_registry_;
77 dsp::ProcessorParameterRegistry param_registry_{ port_registry_ };
78
84
90
97
99 std::atomic_bool dim_output_ = false;
100
107
108 RealtimeTracksProvider rt_tracks_provider_;
109};
110
111}
A Fader is a processor that is used for volume controls and pan.
Definition fader.h:21
Wrapper over a Uuid registry that provides (slow) lookup by unique ID.
Definition parameter.h:523
Processor parameter that accepts automation and modulation sources and integrates with QML and the DS...
Definition parameter.h:225
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:38