Skeleton for NI Maschine2 Surface
[ardour.git] / libs / surfaces / maschine2 / m2controls.h
1 /*
2  * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2, or (at your option)
7  * any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  */
18
19 #ifndef _ardour_surfaces_m2controls_h_
20 #define _ardour_surfaces_m2controls_h_
21
22 #include <map>
23
24 #include "m2_button.h"
25 #include "m2_encoder.h"
26 #include "m2_pad.h"
27
28 namespace ArdourSurface {
29
30 /** Abstraction for various variants:
31  *  - NI Maschine Mikro
32  *  - NI Maschine
33  *  - NI Maschine Studio
34  */
35
36 class M2Contols
37 {
38         public:
39                 M2Contols () {}
40                 virtual ~M2Contols () {}
41
42                 typedef enum {
43                         ModNone = 0,
44                         ModShift,
45                 } Modifier;
46
47                 typedef enum {
48                         /* Transport */
49                         BtnRestart,
50                         BtnStepLeft,
51                         BtnStepRight,
52                         BtnGrid,
53                         BtnPlay,
54                         BtnRec,
55                         BtnErase,
56                         BtnShift,
57
58                         /* modes */
59                         BtnScene,
60                         BtnPattern,
61                         BtnPadMode,
62                         BtnNavigate, // aka. "view" on Mikro
63                         BtnDuplicate,
64                         BtnSelect,
65                         BtnSolo,
66                         BtnMute,
67
68                         /* global */
69 #if 0
70                         BtnArrange, // Studio only
71                         BtnMix,     // Studio only
72 #endif
73
74                         BtnControl, // Studio: "Channel"
75                         BtnStep,    // Studio: "Plug-In"
76                         BtnBrowse,
77                         BtnSampling,
78                         BtnSelLeft,
79                         BtnSelRight,
80                         BtnAll,
81                         BtnAuto,
82
83                         /* master */
84                         BtnVolume,
85                         BtnSwing,
86                         BtnTempo,
87                         BtnNavLeft,
88                         BtnNavRight,
89                         BtnEnter,
90                         BtnNoteRepeat, // Tap
91                         BtnWheel, // Encoder Push
92
93                         /* Selectors above display */
94                         BtnTop0, BtnTop1, BtnTop2, BtnTop3, // Mikro F1, F2, F3
95                         BtnTop4, BtnTop5, BtnTop6, BtnTop7,
96
97                         /* Maschine & Studio "Groups" */
98                         BtnGroupA, BtnGroupB, BtnGroupC, BtnGroupD,
99                         BtnGroupE, BtnGroupF, BtnGroupG, BtnGroupH,
100
101 #if 1 // Studio only -- Edit
102                         BtnCopy,
103                         BtnPaste,
104                         BtnNote,
105                         BtnNudge,
106                         BtnUndo,
107                         BtnRedo,
108                         BtnQuantize,
109                         BtnClear,
110
111                         BtnIn1, BtnIn2, BtnIn3, BtnIn4,
112                         BtnMst, BtnGrp, BtnSnd, BtnCue,
113 #endif
114                 } PhysicalButtonId;
115
116                 typedef enum {
117                         Play,
118                         Rec,
119                         Loop,
120                         Metronom,
121                         GotoStart,
122                         GotoEnd,
123                         JumpBackward,
124                         JumpForward,
125                         FastRewind,
126                         FastForward,
127                         Grid,
128                         Delete,
129                         Undo, Redo,
130                         Save,
131                         EncoderWheel, // multi-purpose
132                         MasterVolume,
133                         MasterTempo,
134                         Solo, Mute,
135                         Panic
136                 } SemanticButtonId;
137
138                 typedef std::map <PhysicalButtonId, M2ButtonInterface*> PhysicalMap;
139                 typedef std::map <SemanticButtonId, M2ButtonInterface*> SematicMap;
140
141                 virtual M2ButtonInterface* button (PhysicalButtonId id, Modifier m) {
142                         if (id == BtnShift) {
143                                 return &_shift;
144                         }
145                         return &_dummy_button;
146                 }
147
148                 virtual M2ButtonInterface* button (SemanticButtonId id) {
149                         return &_dummy_button;
150                 }
151
152                 virtual M2EncoderInterface* encoder (unsigned int id) {
153                         return &_dummy_encoder;
154                 }
155
156                 virtual M2PadInterface* pad (unsigned int id) {
157                         return &_dummy_pad;
158                 }
159
160         protected:
161                 M2ButtonInterface  _dummy_button;
162                 M2EncoderInterface _dummy_encoder;
163                 M2PadInterface     _dummy_pad;
164
165                 M2ToggleHoldButton  _shift;
166 };
167
168 } /* namespace */
169 #endif /* _ardour_surfaces_m2controls_h_*/