Zrythm v2.0.0-alpha.1
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 <span>
7
8#include "dsp/fader.h"
9#include "dsp/metronome.h"
10#include "structure/tracks/track_fwd.h"
11#include "utils/object_registry.h"
12
13namespace zrythm::engine::session
14{
15
24class ControlRoom : public QObject
25{
26 Q_OBJECT
27 Q_PROPERTY (
28 bool dimOutput READ dimOutput WRITE setDimOutput NOTIFY dimOutputChanged)
29 Q_PROPERTY (
30 zrythm::dsp::ProcessorParameter * muteVolume READ muteVolume CONSTANT)
31 Q_PROPERTY (
32 zrythm::dsp::ProcessorParameter * listenVolume READ listenVolume CONSTANT)
33 Q_PROPERTY (
34 zrythm::dsp::ProcessorParameter * dimVolume READ dimVolume CONSTANT)
35 Q_PROPERTY (zrythm::dsp::Fader * monitorFader READ monitorFader CONSTANT)
36 Q_PROPERTY (zrythm::dsp::Metronome * metronome READ metronome CONSTANT FINAL)
37 QML_ELEMENT
38 QML_UNCREATABLE ("")
39
40public:
41 using RealtimeTracks = std::span<structure::tracks::Track * const>;
42 using RealtimeTracksProvider = std::function<RealtimeTracks ()>;
43
44 ControlRoom (
45 RealtimeTracksProvider rt_tracks_provider,
46 QObject * parent = nullptr);
47
48 // ========================================================================
49 // QML Interface
50 // ========================================================================
51
52 bool dimOutput () const { return dim_output_.load (); }
53 void setDimOutput (bool dim)
54 {
55 bool expected = !dim;
56 if (dim_output_.compare_exchange_strong (expected, dim))
57 {
58 Q_EMIT dimOutputChanged (dim);
59 }
60 }
61 Q_SIGNAL void dimOutputChanged (bool dim);
62
63 dsp::ProcessorParameter * muteVolume () const { return mute_volume_.get (); }
64 dsp::ProcessorParameter * listenVolume () const
65 {
66 return listen_volume_.get ();
67 }
68 dsp::ProcessorParameter * dimVolume () const { return dim_volume_.get (); }
69 auto * monitorFader () const { return monitor_fader_.get (); }
70 auto * metronome () const { return metronome_.get (); }
71
72 // ========================================================================
73
74private:
78 utils::ObjectRegistry registry_;
79
85
91
98
100 std::atomic_bool dim_output_ = false;
101
108
116
117 RealtimeTracksProvider rt_tracks_provider_;
118};
119
120}
A Fader is a processor that is used for volume controls and pan.
Definition fader.h:15
Metronome processor.
Definition metronome.h:19
Processor parameter that accepts automation and modulation sources and integrates with QML and the DS...
Definition parameter.h:255
Concrete IObjectRegistry with QObject parent-child ownership and reference counting.
A unique pointer for QObject objects that also works with QObject-based ownership.
Definition qt.h:36