-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathpatch.h
102 lines (77 loc) · 3.27 KB
/
patch.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
// Shruthi-Editor: An unofficial Editor for the Shruthi hardware synthesizer. For
// informations about the Shruthi, see <http://www.mutable-instruments.net/shruthi1>.
//
// Copyright (C) 2011-2019 Manuel Krönig
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#ifndef SHRUTHI_PATCH_H
#define SHRUTHI_PATCH_H
#include <QString>
#include <QCoreApplication> // for tr(), Q_DECLARE_TR_FUNCTIONS() and QT_TR_NOOP()
#include <stddef.h> // for NULL
#include "message.h"
class QStringList;
struct PatchParameter {
QString name;
QString short_name;
int min;
int max;
const QStringList* string_values;
QString (*formatter)(int);
int cc;
};
static const PatchParameter param_blank = {NULL, NULL, 0, 0, NULL, NULL, -1};
class Patch {
Q_DECLARE_TR_FUNCTIONS(Patch)
public:
Patch();
Patch(const unsigned int &version);
static PatchParameter parameter(const int &id, int filter = 0);
static bool enabled(const int &id);
static bool hasUI(const int &id); // widget in main window
static bool hasUI2(const int &id); // widget in sequence editor
static bool sendAsNRPN(const int &id);
static bool belongsToModMatrix(const int &id);
void setValue(const int &id, int value);
const int &getValue(const int &id) const;
static QString formatParameterValue(const int &id, const int &value, int filter = 0);
void setName(const QString &name);
const QString &getName() const;
QString getVersionString() const;
void reset(unsigned int version = 1000);
void randomize(const int &filter);
bool unpackData(const unsigned char *sysex);
void packData(unsigned char res[]) const;
bool parseSysex(const Message *message);
void generateSysex(Message *message) const;
bool equals(const Patch &other) const;
void set(const Patch &other);
static unsigned char ccToId(const unsigned char &cc, const int &filter);
static int convertCCValue(const unsigned int &val, int &id, const int &filter);
static const unsigned char parameterCount;
static const unsigned char filterBoardCount;
private:
void printPatch() const;
QString name;
int data[110];
unsigned char version;
static const PatchParameter parameters[];
static const PatchParameter parameter84[];
static const PatchParameter parameter85[];
static const PatchParameter parameter92[];
static const PatchParameter parameter93[];
static const unsigned char INIT_PATCH[];
static const unsigned char INIT_PATCH_PRE100[];
};
#endif // SHRUTHI_PATCH_H