1 //=========================================================
2 //  MusE
3 //  Linux Music Editor
4 //  $Id: drummap.h,v 1.3.2.3 2009/10/29 02:14:37 terminator356 Exp $
5 //
6 //  (C) Copyright 1999/2000 Werner Schweer (ws@seh.de)
7 //  (C) Copyright 2016 Tim E. Real (terminator356 on users dot sourceforge dot net)
8 //
9 //  This program is free software; you can redistribute it and/or
10 //  modify it under the terms of the GNU General Public License
11 //  as published by the Free Software Foundation; version 2 of
12 //  the License, or (at your option) any later version.
13 //
14 //  This program is distributed in the hope that it will be useful,
15 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 //  GNU General Public License for more details.
18 //
19 //  You should have received a copy of the GNU General Public License
20 //  along with this program; if not, write to the Free Software
21 //  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22 //
23 //=========================================================
24 
25 #ifndef __DRUMMAP_H__
26 #define __DRUMMAP_H__
27 
28 #include <QString>
29 
30 namespace MusECore {
31 
32 class Xml;
33 
34 //---------------------------------------------------------
35 //   DrumMap
36 //---------------------------------------------------------
37 
38 struct DrumMap {
39       QString name;
40       unsigned char vol;            // playback volume, percent.
41       int quant;
42       int len;                      // len of event in ticks
43 
44       // Default to track port if -1 and track channel if -1.
45       int channel;                  // midi channel
46       int port;                     // midi port
47 
48       char lv1, lv2, lv3, lv4;      // velocities
49       char enote, anote;            // input note - output note
50       bool mute;
51       bool hide;
52 
53       // Initializes the structure. NOTE: Be sure the enote value
54       //  does not conflict with another map item's enote value.
initDrumMap55       void init() {
56         vol = 100;
57         quant = 16;
58         len = 32;
59         channel = -1;
60         port = -1;
61         lv1 = 70;
62         lv2 = 90;
63         lv3 = 110;
64         lv4 = 127;
65         enote = 0;
66         anote = 0;
67         mute = false;
68       };
69 
70       bool operator==(const DrumMap& map) const;
71       bool operator!=(const DrumMap& map) const { return !operator==(map); }
72       bool almost_equals(const DrumMap& map) const;
73 
74       void dump();
75       };
76 
77 // please let this at "128". idrumMap should have length 128 (see drummap.cpp for details)
78 #define DRUM_MAPSIZE  128
79 
80 extern DrumMap iNewDrumMap[128];
81 extern void initNewDrumMap();
82 
83 extern void clearDrumMap();  // One-time only early init
84 extern void initDrumMap();
85 extern void writeDrumMap(int level, Xml& xml, bool external);
86 extern void readDrumMap(Xml& xml, bool external);
87 extern void resetGMDrumMap();
88 
89 } // namespace MusECore
90 
91 namespace MusEGlobal {
92 extern char drumOutmap[DRUM_MAPSIZE];
93 extern char drumInmap[DRUM_MAPSIZE];
94 extern MusECore::DrumMap drumMap[DRUM_MAPSIZE];
95 
96 }
97 
98 #endif
99 
100