aboutsummaryrefslogtreecommitdiff
path: root/utils/gen_adldata/progs_cache.h
diff options
context:
space:
mode:
authorWohlstand <admin@wohlnet.ru>2017-10-20 04:28:53 +0300
committerWohlstand <admin@wohlnet.ru>2017-10-20 04:28:53 +0300
commiteb45a7913d83fe2a3dc03033230950e78fb9755d (patch)
treed7318e79b08404f293fb99bb22e0ed202e07d890 /utils/gen_adldata/progs_cache.h
parente95cde9fea4f9daf3e19492021b8a153acae0404 (diff)
downloadlibADLMIDI-eb45a7913d83fe2a3dc03033230950e78fb9755d.tar.gz
libADLMIDI-eb45a7913d83fe2a3dc03033230950e78fb9755d.tar.bz2
libADLMIDI-eb45a7913d83fe2a3dc03033230950e78fb9755d.zip
Added CMake support
Diffstat (limited to 'utils/gen_adldata/progs_cache.h')
-rw-r--r--utils/gen_adldata/progs_cache.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/utils/gen_adldata/progs_cache.h b/utils/gen_adldata/progs_cache.h
new file mode 100644
index 0000000..007c3b4
--- /dev/null
+++ b/utils/gen_adldata/progs_cache.h
@@ -0,0 +1,85 @@
+#ifndef PROGS_H
+#define PROGS_H
+
+#include <map>
+#include <set>
+#include <utility>
+#include <memory>
+#include <cstring>
+#include <cstdint>
+#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
+ {
+ 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);
+ }
+};
+
+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