Debian Codegraph @

BambooTracker/gui/instrument_editor/fm_instrument_editor.hpp

raw
1 /*
2 * Copyright (C) 2018-2022 Rerrah
3 *
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use,
8 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9 * copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following
11 * conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23 * OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 #pragma once
27
28 #include <QKeyEvent>
29 #include <QResizeEvent>
30 #include <QShowEvent>
31 #include <memory>
32 #include "instrument.hpp"
33 #include "gui/instrument_editor/instrument_editor.hpp"
34 #include "gui/instrument_editor/visualized_instrument_macro_editor.hpp"
35
36 namespace Ui {
37 class FmInstrumentEditor;
38 }
39
40 class FmInstrumentEditor final : public InstrumentEditor
41 {
42 Q_OBJECT
43
44 public:
45 FmInstrumentEditor(int num, QWidget* parent = nullptr);
46 ~FmInstrumentEditor() override;
47
48 /**
49 * @brief Return sound source of instrument related to this dialog.
50 * @return FM.
51 */
52 SoundSource getSoundSource() const override;
53
54 /**
55 * @brief Return instrument type of instrument related to this dialog.
56 * @return FM.
57 */
58 InstrumentType getInstrumentType() const override;
59
60 void updateByConfigurationChange() override;
61
62 protected:
63 void keyPressEvent(QKeyEvent* event) override;
64 void keyReleaseEvent(QKeyEvent* event) override;
65 void showEvent(QShowEvent*) override;
66 void resizeEvent(QResizeEvent*) override;
67
68 private:
69 Ui::FmInstrumentEditor *ui;
70 bool isIgnoreEvent_;
71
72 // FM specific process called in settiing core / cofiguration / color palette.
73 void updateBySettingCore() override;
74 void updateBySettingConfiguration() override;
75 void updateBySettingColorPalette() override;
76
77 void updateInstrumentParameters();
78
79 //========== Envelope ==========//
80 signals:
81 void envelopeNumberChanged();
82 void envelopeParameterChanged(int envNum, int fromInstNum);
83
84 public slots:
85 void onEnvelopeParameterChanged(int envNum);
86 void onEnvelopeNumberChanged();
87
88 private:
89 void setInstrumentEnvelopeParameters();
90 void setInstrumentEnvelopeParameters(QString data);
91 void setInstrumentEnvelopeParameters(int envTypeNum, QString data);
92 void setInstrumentOperatorParameters(int opNum, QString data);
93
94 void paintAlgorithmDiagram();
95 void resizeAlgorithmDiagram();
96
97 private slots:
98 void copyEnvelope();
99 void pasteEnvelope();
100 void pasteEnvelopeFrom(int typenum);
101 void copyOperator(int opNum);
102 void pasteOperator(int opNum);
103 void on_envNumSpinBox_valueChanged(int arg1);
104 void on_envGroupBox_customContextMenuRequested(const QPoint &pos);
105
106 //========== LFO ==========//
107 signals:
108 void lfoNumberChanged();
109 void lfoParameterChanged(int lfoNum, int fromInstNum);
110
111 public slots:
112 void onLFOParameterChanged(int lfoNum);
113 void onLFONumberChanged();
114
115 private:
116 void setInstrumentLFOParameters();
117 void setInstrumentLFOParameters(QString data);
118
119 QString toLFOString() const;
120
121 private slots:
122 void on_lfoGroupBox_customContextMenuRequested(const QPoint &pos);
123 void on_lfoNumSpinBox_valueChanged(int arg1);
124 void on_lfoGroupBox_toggled(bool arg1);
125
126 //========== OperatorSequence ==========//
127 public:
128 FMEnvelopeParameter getOperatorSequenceParameter() const;
129
130 signals:
131 void operatorSequenceNumberChanged();
132 void operatorSequenceParameterChanged(FMEnvelopeParameter param, int opSeqNum, int fromInstNum);
133
134 public slots:
135 void onOperatorSequenceNumberChanged();
136 void onOperatorSequenceParameterChanged(FMEnvelopeParameter param, int opSeqNum);
137
138 private:
139 void setInstrumentOperatorSequenceParameters();
140 void setOperatorSequenceEditor();
141
142 private slots:
143 void onOperatorSequenceTypeChanged(int);
144 void on_opSeqEditGroupBox_toggled(bool arg1);
145 void on_opSeqNumSpinBox_valueChanged(int arg1);
146
147 //========== Arpeggio ==========//
148 public:
149 FMOperatorType getArpeggioOperator() const;
150
151 signals:
152 void arpeggioNumberChanged();
153 void arpeggioParameterChanged(int arpNum, int fromInstNum);
154
155 public slots:
156 void onArpeggioNumberChanged();
157 void onArpeggioParameterChanged(int arpNum);
158
159 private:
160 void setInstrumentArpeggioParameters();
161
162 private slots:
163 void onArpeggioOperatorChanged(int);
164 void onArpeggioTypeChanged(int);
165 void on_arpEditGroupBox_toggled(bool arg1);
166 void on_arpNumSpinBox_valueChanged(int arg1);
167
168 //========== Pitch ==========//
169 public:
170 FMOperatorType getPitchOperator() const;
171
172 signals:
173 void pitchNumberChanged();
174 void pitchParameterChanged(int ptNum, int fromInstNum);
175
176 public slots:
177 void onPitchNumberChanged();
178 void onPitchParameterChanged(int ptNum);
179
180 private:
181 void setInstrumentPitchParameters();
182
183 private slots:
184 void onPitchOperatorChanged(int);
185 void onPitchTypeChanged(int);
186 void on_ptEditGroupBox_toggled(bool arg1);
187 void on_ptNumSpinBox_valueChanged(int arg1);
188
189 //========== Pan ==========//
190 signals:
191 void panNumberChanged();
192 void panParameterChanged(int panNum, int fromInstNum);
193
194 public slots:
195 void onPanNumberChanged();
196 void onPanParameterChanged(int panNum);
197
198 private:
199 void setInstrumentPanParameters();
200
201 private slots:
202 void on_panEditGroupBox_toggled(bool arg1);
203 void on_panNumSpinBox_valueChanged(int arg1);
204
205 //========== Others ==========//
206
207 private:
208 void setInstrumentEnvelopeResetParameters();
209 };