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 #ifndef _ardour_surfaces_m2mikro_h_
20 #define _ardour_surfaces_m2mikro_h_
24 #include <cairomm/context.h>
25 #include <pangomm/layout.h>
27 namespace ArdourSurface {
29 class Maschine2Mikro : public M2Device
33 void clear (bool splash = false);
34 void read (hid_device*, M2Contols*);
35 void write (hid_device*, M2Contols*);
36 Cairo::RefPtr<Cairo::ImageSurface> surface () { return _surface; }
41 #define ATTRIBUTE_PACKED __attribute__((__packed__))
43 #define ATTRIBUTE_PACKED
47 struct machine_mk2_input {
48 unsigned int trs_restart : 1; // 0
49 unsigned int trs_left : 1;
50 unsigned int trs_right : 1;
51 unsigned int trs_grid : 1;
52 unsigned int trs_play : 1;
53 unsigned int trs_rec : 1;
54 unsigned int trs_erase : 1;
55 unsigned int trs_shift : 1;
56 unsigned int group : 1; // 8
57 unsigned int browse : 1;
58 unsigned int sampling : 1;
59 unsigned int note_repeat : 1;
60 unsigned int mst_wheel : 1;
61 unsigned int reserved : 3;
62 unsigned int f1 : 1; // 16
65 unsigned int control : 1;
66 unsigned int navigate : 1;
67 unsigned int nav_left : 1;
68 unsigned int nav_right : 1;
69 unsigned int main : 1;
70 unsigned int pads_scene : 1; // 24
71 unsigned int pads_pattern : 1;
72 unsigned int pads_mode : 1;
73 unsigned int pads_navigate : 1;
74 unsigned int pads_duplicate : 1;
75 unsigned int pads_select : 1;
76 unsigned int pads_solo : 1;
77 unsigned int pads_mute : 1; // 31
78 unsigned int mst_wheel_pos : 8; // 32..40 // range: 0..15
79 } ATTRIBUTE_PACKED ctrl_in;
81 #if (!defined __GNUC__)
86 Cairo::RefPtr<Cairo::ImageSurface> _surface;
89 void assign_controls (M2Contols*) const;
91 void set_lights (M2Contols*, uint8_t*) const;
92 void set_pads (M2Contols*, uint8_t*) const;