Ardour  9.0-pre0-582-g084a23a80d
m2_dev_mikro.h
Go to the documentation of this file.
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 of the License, or
7  * (at your option) 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 along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef _ardour_surfaces_m2mikro_h_
20 #define _ardour_surfaces_m2mikro_h_
21 
22 #include "m2device.h"
23 
24 #include <cairomm/context.h>
25 #include <pangomm/layout.h>
26 
27 namespace ArdourSurface {
28 
29 class Maschine2Mikro : public M2Device
30 {
31  public:
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; }
37 
38  private:
39 
40 #if defined(__GNUC__)
41 #define ATTRIBUTE_PACKED __attribute__((__packed__))
42 #else
43 #define ATTRIBUTE_PACKED
44 #pragma pack(1)
45 #endif
46 
48  unsigned int trs_shift : 1; // 0
49  unsigned int trs_erase : 1;
50  unsigned int trs_rec : 1;
51  unsigned int trs_play : 1;
52  unsigned int trs_grid : 1;
53  unsigned int trs_right : 1;
54  unsigned int trs_left : 1;
55  unsigned int trs_restart : 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
63  unsigned int f2 : 1;
64  unsigned int f3 : 1;
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_mute : 1; // 24
71  unsigned int pads_solo : 1;
72  unsigned int pads_select : 1;
73  unsigned int pads_duplicate : 1;
74  unsigned int pads_navigate : 1;
75  unsigned int pads_mode : 1;
76  unsigned int pads_pattern : 1;
77  unsigned int pads_scene : 1; // 31
78  unsigned int mst_wheel_pos : 8; // 32..40 // range: 0..15
80 
81 #if (!defined __GNUC__)
82 #pragma pack()
83 #endif
84  uint16_t pad[16];
85 
86  Cairo::RefPtr<Cairo::ImageSurface> _surface;
87 
88  private:
89  void assign_controls (M2Contols*) const;
90 
91  void set_lights (M2Contols*, uint8_t*) const;
92  void set_pads (M2Contols*, uint8_t*) const;
93 
94  uint8_t _lights[79];
95  uint8_t _img[4][265];
96 };
97 } /* namespace */
98 
99 #endif
Cairo::RefPtr< Cairo::ImageSurface > _surface
Definition: m2_dev_mikro.h:86
Cairo::RefPtr< Cairo::ImageSurface > surface()
Definition: m2_dev_mikro.h:36
void set_lights(M2Contols *, uint8_t *) const
void read(hid_device *, M2Contols *)
struct ArdourSurface::Maschine2Mikro::machine_mk2_input ctrl_in
void assign_controls(M2Contols *) const
void write(hid_device *, M2Contols *)
void clear(bool splash=false)
void set_pads(M2Contols *, uint8_t *) const
#define ATTRIBUTE_PACKED
Definition: m2_dev_mikro.h:43