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-2026 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include "dsp/fader.h"
7#include "dsp/metronome.h"
8#include "structure/tracks/track_fwd.h"
9
10#include <boost/unordered/unordered_flat_map_fwd.hpp>
11
12namespace zrythm::engine::session
13{
14
23class ControlRoom : public QObject
24{
25 Q_OBJECT
26 Q_PROPERTY (
27 bool dimOutput READ dimOutput WRITE setDimOutput NOTIFY dimOutputChanged)
28 Q_PROPERTY (
29 zrythm::dsp::ProcessorParameter * muteVolume READ muteVolume CONSTANT)
30 Q_PROPERTY (
31 zrythm::dsp::ProcessorParameter * listenVolume READ muteVolume CONSTANT)
32 Q_PROPERTY (
33 zrythm::dsp::ProcessorParameter * dimVolume READ muteVolume CONSTANT)
34 Q_PROPERTY (zrythm::dsp::Fader * monitorFader READ monitorFader CONSTANT)
35 Q_PROPERTY (zrythm::dsp::Metronome * metronome READ metronome CONSTANT FINAL)
36 QML_ELEMENT
37 QML_UNCREATABLE ("")
38
39public:
40 using RealtimeTracks = boost::unordered_flat_map<
41 structure::tracks::TrackUuid,
42 structure::tracks::TrackPtrVariant>;
43 using RealtimeTracksProvider = std::function<const RealtimeTracks &()>;
44
45 ControlRoom (
46 RealtimeTracksProvider rt_tracks_provider,
47 QObject * parent = nullptr);
48
49 // ========================================================================
50 // QML Interface
51 // ========================================================================
52
53 bool dimOutput () const { return dim_output_.load (); }
54 void setDimOutput (bool dim)
55 {
56 bool expected = !dim;
57 if (dim_output_.compare_exchange_strong (expected, dim))
58 {
59 Q_EMIT dimOutputChanged (dim);
60 }
61 }
62 Q_SIGNAL void dimOutputChanged (bool dim);
63
64 dsp::ProcessorParameter * muteVolume () const { return mute_volume_.get (); }
65 dsp::ProcessorParameter * listenVolume () const
66 {
67 return listen_volume_.get ();
68 }
69 dsp::ProcessorParameter * dimVolume () const { return dim_volume_.get (); }
70 auto * monitorFader () const { return monitor_fader_.get (); }
71 auto * metronome () const { return metronome_.get (); }
72
73 // ========================================================================
74
75private:
79 dsp::PortRegistry port_registry_;
80 dsp::ProcessorParameterRegistry param_registry_{ port_registry_ };
81
87
93
100
102 std::atomic_bool dim_output_ = false;
103
110
118
119 RealtimeTracksProvider rt_tracks_provider_;
120};
121
122}
A Fader is a processor that is used for volume controls and pan.
Definition fader.h:21
Metronome processor.
Definition metronome.h:20
Wrapper over a Uuid registry that provides (slow) lookup by unique ID.
Definition parameter.h:505
Processor parameter that accepts automation and modulation sources and integrates with QML and the DS...
Definition parameter.h:220
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:38