2 * Copyright (C) 2016 Robin Gareus <robin@gareus.org>
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)
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.
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.
19 #include "m2_map_mk2.h"
21 using namespace ArdourSurface;
28 #define PSMAP(MOD, PHYS, SEM, BTN) \
29 pmap[MOD].insert (make_pair (PHYS, BTN)); \
30 smap.insert (make_pair (SEM, BTN));
32 #define PSMAPALL(PHYS, SEM, BTN) \
33 pmap[ModNone].insert (make_pair (PHYS, BTN)); \
34 pmap[ModShift].insert (make_pair (PHYS, BTN)); \
35 smap.insert (make_pair (SEM, BTN)); \
37 PSMAP(ModNone, BtnPlay, Play, &tr[0]);
38 PSMAP(ModShift, BtnPlay, Metronom, &tr[1]);
39 PSMAP(ModNone, BtnRec, Rec, &tr[2]);
40 PSMAP(ModNone, BtnGrid, Grid, &tr[3]);
41 PSMAP(ModNone, BtnRestart, GotoStart, &ts[0]);
42 PSMAP(ModShift, BtnRestart, Loop, &tr[4]);
44 PSMAP(ModNone, BtnStepLeft, FastRewind, &ts[1]);
45 PSMAP(ModNone, BtnStepRight, FastForward, &ts[2]);
46 PSMAP(ModShift, BtnStepLeft, JumpBackward, &ts[3]);
47 PSMAP(ModShift, BtnStepRight, JumpForward, &ts[4]);
49 PSMAPALL(BtnWheel, EncoderWheel, &mst[0]);
50 PSMAPALL(BtnVolume, MasterVolume, &mst[1]);
51 //PSMAPALL(BtnSwing, Master?????, &mst[2]);
52 PSMAPALL(BtnTempo, MasterTempo, &mst[3]);
54 PSMAP(ModShift, BtnAll, Save, &save);
56 PSMAP(ModShift, BtnNavLeft, Undo, &undoredo[0]);
57 PSMAP(ModShift, BtnNavRight, Redo, &undoredo[1]);
59 PSMAP(ModNone, BtnMute, Mute, &sm[0]);
60 PSMAP(ModShift, BtnMute, Panic, &panic);
61 PSMAPALL(BtnSolo, Solo, &sm[1]);
64 pmap[ModNone].insert (make_pair (BtnErase, &ts[5]));
65 pmap[ModShift].insert (make_pair (BtnErase, &ts[5]));
70 M2MapMk2::button (PhysicalButtonId id, Modifier m)
72 PhysicalMap::const_iterator i = pmap[m].find (id);
73 if (i != pmap[m].end()) {
76 return M2Contols::button (id, m);
80 M2MapMk2::button (SemanticButtonId id)
82 SematicMap::const_iterator i = smap.find (id);
83 if (i != smap.end()) {
86 return M2Contols::button (id);
90 M2MapMk2::encoder (unsigned int id)
96 return &enc_top[id - 1];
98 return M2Contols::encoder (id);
102 M2MapMk2::pad (unsigned int id)
107 return M2Contols::pad (id);