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
|
#ifndef PROGS_H
#define PROGS_H
#include <map>
#include <set>
#include <utility>
#include <memory>
#include <cstring>
#include <cstdint>
#include <string>
#include <vector>
struct insdata
{
uint8_t data[11];
int8_t finetune;
bool diff;
bool operator==(const insdata &b) const
{
return (std::memcmp(data, b.data, 11) == 0) && (finetune == b.finetune) && (diff == b.diff);
}
bool operator!=(const insdata &b) const
{
return !operator==(b);
}
bool operator<(const insdata &b) const
{
int c = std::memcmp(data, b.data, 11);
if(c != 0) return c < 0;
if(finetune != b.finetune) return finetune < b.finetune;
if(diff != b.diff) return (!diff) == (b.diff);
return 0;
}
bool operator>(const insdata &b) const
{
return !operator<(b) && operator!=(b);
}
};
struct ins
{
size_t insno1, insno2;
unsigned char notenum;
bool pseudo4op;
double voice2_fine_tune;
bool operator==(const ins &b) const
{
return notenum == b.notenum
&& insno1 == b.insno1
&& insno2 == b.insno2
&& pseudo4op == b.pseudo4op
&& voice2_fine_tune == b.voice2_fine_tune;
}
bool operator< (const ins &b) const
{
if(insno1 != b.insno1) return insno1 < b.insno1;
if(insno2 != b.insno2) return insno2 < b.insno2;
if(notenum != b.notenum) return notenum < b.notenum;
if(pseudo4op != b.pseudo4op) return pseudo4op < b.pseudo4op;
if(voice2_fine_tune != b.voice2_fine_tune) return voice2_fine_tune < b.voice2_fine_tune;
return 0;
}
bool operator!=(const ins &b) const
{
return !operator==(b);
}
};
typedef std::map<insdata, std::pair<size_t, std::set<std::string> > > InstrumentDataTab;
extern InstrumentDataTab insdatatab;
typedef std::map<ins, std::pair<size_t, std::set<std::string> > > InstrumentsData;
extern InstrumentsData instab;
typedef std::map<size_t, std::map<size_t, size_t> > InstProgsData;
extern InstProgsData progs;
extern std::vector<std::string> banknames;
//static std::map<unsigned, std::map<unsigned, unsigned> > Correlate;
//extern unsigned maxvalues[30];
void SetBank(unsigned bank, unsigned patch, size_t insno);
size_t InsertIns(const insdata &id, const insdata &id2, ins &in,
const std::string &name, const std::string &name2);
size_t InsertNoSoundIns();
#endif // PROGS_H
|