Zrythm v2.0.0-DEV
a highly automated and intuitive digital audio workstation
Loading...
Searching...
No Matches
parameter_operator.h
1// SPDX-FileCopyrightText: © 2025 Alexandros Theodotou <alex@zrythm.org>
2// SPDX-License-Identifier: LicenseRef-ZrythmLicense
3
4#pragma once
5
6#include <stdexcept>
7
8#include "dsp/parameter.h"
9#include "undo/undo_stack.h"
10
11#include <QtQmlIntegration/qqmlintegration.h>
12
13namespace zrythm::actions
14{
15class ProcessorParameterOperator : public QObject
16{
17 Q_OBJECT
18 Q_PROPERTY (
19 zrythm::dsp::ProcessorParameter * processorParameter READ processorParameter
20 WRITE setProcessorParameter NOTIFY processorParameterChanged)
21 Q_PROPERTY (
22 zrythm::undo::UndoStack * undoStack READ undoStack WRITE setUndoStack NOTIFY
23 undoStackChanged)
24 QML_ELEMENT
25
26public:
27 explicit ProcessorParameterOperator (QObject * parent = nullptr)
28 : QObject (parent)
29 {
30 }
31
32 Q_SIGNAL void processorParameterChanged ();
33 Q_SIGNAL void undoStackChanged ();
34
35 dsp::ProcessorParameter * processorParameter () const { return param_; }
36 void setProcessorParameter (dsp::ProcessorParameter * param)
37 {
38 if (param == nullptr)
39 {
40 throw std::invalid_argument ("Param cannot be null");
41 }
42 if (param_ != param)
43 {
44 param_ = param;
45 Q_EMIT processorParameterChanged ();
46 }
47 }
48
49 undo::UndoStack * undoStack () const { return undo_stack_; }
50 void setUndoStack (undo::UndoStack * undoStack)
51 {
52 if (undoStack == nullptr)
53 {
54 throw std::invalid_argument ("UndoStack cannot be null");
55 }
56 if (undo_stack_ != undoStack)
57 {
58 undo_stack_ = undoStack;
59 Q_EMIT undoStackChanged ();
60 }
61 }
62
63 Q_INVOKABLE void setValue (float value);
64
65private:
66 dsp::ProcessorParameter * param_{};
67 undo::UndoStack * undo_stack_{};
68};
69}
Processor parameter that accepts automation and modulation sources and integrates with QML and the DS...
Definition parameter.h:225