-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpatch.h
71 lines (58 loc) · 1.39 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
/*
* A patch.
*
* TODO use more accurate type declarations.
*/
#define PATCHNAME_LEN 8 // Max length of patch names.
struct patchSettings {
// Oscillators
// A: 0-6
int waveOscA; // 0 - 6
int pulseWidthOscA; // 12-bit
int attackOscA; // nibble
int decayOscA; // nibble
int sustainOscA; // nibble
int releaseOscA; // nibble
int filterOscA; // bool
// B: 7-14
int waveOscB;
int pulseWidthOscB;
int attackOscB;
int decayOscB;
int sustainOscB;
int releaseOscB;
int filterOscB;
int detuneOscB;
// C: 15-22
int waveOscC;
int pulseWidthOscC;
int attackOscC;
int decayOscC;
int sustainOscC;
int releaseOscC;
int filterOscC;
int detuneOscC;
// Filter: 23-25
int cutoff; // 11-bit
int resonance; // nibble
int mode; // 0 - 4
// General: 26
int volume; // nibble
// portamento
// retrigger
// System
int id;
char name[8];
};
struct livePatch {
uint8_t registers[25];
patchSettings patch;
int note;
};
// Returns two bytes, one register value in each.
uint16_t patchParamRegister(int param);
void patchToRegisters(livePatch *p);
int loadPatchValue(int param, livePatch *p);
// Update the setting, and the register value.
void setPatchValue(livePatch *p, int param, int val);
bool copyPatch(patchSettings *pSrc, livePatch *pDest);