summaryrefslogtreecommitdiff
path: root/muse2/muse/instruments/minstrument.h
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-12-30 17:55:58 +0000
committerFlorian Jung <flo@windfisch.org>2011-12-30 17:55:58 +0000
commit6f35a1b2b84ab6cfc5d77fd46d5e31887a1590e1 (patch)
treeadece0e0c4fbe63659741539296df9fd32bfcaab /muse2/muse/instruments/minstrument.h
parent4d8477ab60093fc4c1f6190a931d0c2fdc65384c (diff)
instruments can load their patch'es drummaps
automatic setting of drummap according to patch this is turned off when the user manually changes the drummap TODO: let him turn it on again moved MidiTrack::read/writeOurDrummap out to helper.cpp extended xg.idf and gs.idf to ship the drummaps still work in progress, but should be usable and stable, though incomplete
Diffstat (limited to 'muse2/muse/instruments/minstrument.h')
-rw-r--r--muse2/muse/instruments/minstrument.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/muse2/muse/instruments/minstrument.h b/muse2/muse/instruments/minstrument.h
index 385e67b4..9a65598b 100644
--- a/muse2/muse/instruments/minstrument.h
+++ b/muse2/muse/instruments/minstrument.h
@@ -40,6 +40,7 @@ class MidiControllerList;
class MidiPort;
class MidiPlayEvent;
class Xml;
+class DrumMap;
//---------------------------------------------------------
@@ -80,6 +81,43 @@ struct SysEx {
unsigned char* data;
};
+
+
+struct patch_collection_t
+{
+ int first_program;
+ int last_program;
+ int first_hbank;
+ int last_hbank;
+ int first_lbank;
+ int last_lbank;
+
+ patch_collection_t(int p1=0, int p2=127, int l1=0, int l2=127, int h1=0, int h2=127)
+ {
+ first_program=p1;
+ last_program=p2;
+ first_lbank=l1;
+ last_lbank=l2;
+ first_hbank=h1;
+ last_hbank=h2;
+ }
+
+};
+
+struct patch_drummap_mapping_t
+{
+ std::list<patch_collection_t> affected_patches;
+ DrumMap* drummap;
+
+ patch_drummap_mapping_t(const std::list<patch_collection_t>& a, DrumMap* d)
+ {
+ affected_patches=a;
+ drummap=d;
+ }
+
+ patch_drummap_mapping_t();
+};
+
//---------------------------------------------------------
// MidiInstrument
//---------------------------------------------------------
@@ -88,6 +126,7 @@ class MidiInstrument {
PatchGroupList pg;
MidiControllerList* _controller;
QList<SysEx*> _sysex;
+ std::list<patch_drummap_mapping_t> patch_drummap_mapping;
bool _dirty;
int _nullvalue;
@@ -103,6 +142,12 @@ class MidiInstrument {
char* _initScript;
QString _name;
QString _filePath;
+
+ void clear_delete_patch_drummap_mapping();
+
+ void readDrummaps(Xml& xml);
+ patch_drummap_mapping_t readDrummapsEntry(Xml& xml);
+ patch_collection_t readDrummapsEntryPatchCollection(Xml& xml);
public:
MidiInstrument();
@@ -123,6 +168,8 @@ class MidiInstrument {
void removeSysex(SysEx* sysex) { _sysex.removeAll(sysex); }
void addSysex(SysEx* sysex) { _sysex.append(sysex); }
+ const DrumMap* drummap_for_patch(int patch) const;
+
EventList* midiInit() const { return _midiInit; }
EventList* midiReset() const { return _midiReset; }
EventList* midiState() const { return _midiState; }