Debian Codegraph @

BambooTracker/gui/instrument_editor/adpcm_drumkit_editor.hpp

raw
1 /*
2 * Copyright (C) 2020-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 <memory>
29 #include <QKeyEvent>
30 #include <QTreeWidgetItem>
31 #include "gui/instrument_editor/instrument_editor.hpp"
32
33 namespace Ui {
34 class AdpcmDrumkitEditor;
35 }
36
37 class AdpcmDrumkitEditor final : public InstrumentEditor
38 {
39 Q_OBJECT
40
41 public:
42 explicit AdpcmDrumkitEditor(int num, QWidget* parent = nullptr);
43 ~AdpcmDrumkitEditor() override;
44
45 /**
46 * @brief Return sound source of instrument related to this dialog.
47 * @return ADPCM.
48 */
49 SoundSource getSoundSource() const override;
50
51 /**
52 * @brief Return instrument type of instrument related to this dialog.
53 * @return Drumkit.
54 */
55 InstrumentType getInstrumentType() const override;
56
57 void updateByConfigurationChange() override {}
58
59 protected:
60 bool eventFilter(QObject* watched, QEvent* event) override;
61 void showEvent(QShowEvent*) override;
62 void keyPressEvent(QKeyEvent* event) override;
63 void keyReleaseEvent(QKeyEvent* event) override;
64
65 private:
66 Ui::AdpcmDrumkitEditor *ui;
67 bool isIgnoreEvent_;
68 bool hasShown_;
69
70 // Drumkit specific process called in settiing core / cofiguration / color palette.
71 void updateBySettingCore() override;
72 void updateBySettingConfiguration() override;
73 void updateBySettingColorPalette() override;
74
75 void updateInstrumentParameters();
76
77 private slots:
78 void on_keyTreeWidget_currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*);
79 void on_splitter_splitterMoved(int pos, int);
80
81 //========== Pitch ==========//
82 private slots:
83 void on_pitchSpinBox_valueChanged(int arg1);
84
85 //========== Pan ==========//
86 private slots:
87 void on_panHorizontalSlider_valueChanged(int value);
88
89 //========== Sample ==========//
90 signals:
91 void sampleNumberChanged();
92 void sampleParameterChanged(int sampNum, int fromInstNum);
93 void sampleAssignRequested();
94 void sampleMemoryChanged();
95
96 public slots:
97 void onSampleNumberChanged();
98 void onSampleParameterChanged(int sampNum);
99 void onSampleMemoryUpdated();
100
101 private slots:
102 void on_sampleGroupBox_clicked(bool checked);
103
104 private:
105 void setInstrumentSampleParameters(int key);
106 };