NOOP, remove trailing tabs/whitespace.
[ardour.git] / libs / surfaces / mackie / device_info.h
1 /*
2   Copyright (C) 2006,2007 John Anderson
3   Copyright (C) 2012 Paul Davis
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program; if not, write to the Free Software
17   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #ifndef __ardour_mackie_control_protocol_device_info_h__
21 #define __ardour_mackie_control_protocol_device_info_h__
22
23 #include <iostream>
24 #include <stdint.h>
25 #include <string>
26 #include <map>
27
28 #include "button.h"
29
30 class XMLNode;
31
32 namespace ArdourSurface {
33
34 namespace Mackie {
35
36 struct GlobalButtonInfo {
37         std::string label; // visible to user
38         std::string group; // in case we want to present in a GUI
39         int32_t id;       // value sent by device
40
41         GlobalButtonInfo () : id (-1) {}
42         GlobalButtonInfo (const std::string& l, const std::string& g, uint32_t i)
43                 : label (l), group (g), id (i) {}
44 };
45
46 struct StripButtonInfo {
47         int32_t base_id;
48         std::string name;
49
50         StripButtonInfo () : base_id (-1) {}
51         StripButtonInfo (uint32_t i, const std::string& n)
52                 : base_id (i), name (n) {}
53 };
54
55 class DeviceInfo
56 {
57                                         public:
58         enum DeviceType {
59                 MCU = 0x14,
60                 MCXT = 0x15,
61                 LC = 0x10,
62                 LCXT = 0x11,
63                 HUI = 0x5
64         };
65
66         DeviceInfo();
67         ~DeviceInfo();
68
69         int set_state (const XMLNode&, int version);
70
71         DeviceType device_type() const { return _device_type; }
72         uint32_t strip_cnt () const;
73         uint32_t extenders() const;
74         uint32_t master_position() const;
75         bool has_two_character_display() const;
76         bool has_master_fader () const;
77         bool has_timecode_display() const;
78         bool has_global_controls() const;
79         bool has_jog_wheel () const;
80         bool has_touch_sense_faders() const;
81         bool uses_ipmidi() const;
82         bool no_handshake() const;
83         bool has_meters() const;
84         const std::string& name() const;
85
86         static std::map<std::string,DeviceInfo> device_info;
87         static void reload_device_info();
88
89         std::string& get_global_button_name(Button::ID);
90         GlobalButtonInfo& get_global_button(Button::ID);
91
92         typedef std::map<Button::ID,GlobalButtonInfo> GlobalButtonsInfo;
93         typedef std::map<Button::ID,StripButtonInfo> StripButtonsInfo;
94
95         const GlobalButtonsInfo& global_buttons() const { return _global_buttons; }
96         const StripButtonsInfo& strip_buttons() const { return _strip_buttons; }
97
98                                         private:
99         uint32_t _strip_cnt;
100         uint32_t _extenders;
101         uint32_t _master_position;
102         bool     _has_two_character_display;
103         bool     _has_master_fader;
104         bool     _has_timecode_display;
105         bool     _has_global_controls;
106         bool     _has_jog_wheel;
107         bool     _has_touch_sense_faders;
108         bool     _uses_logic_control_buttons;
109         bool     _uses_ipmidi;
110         bool     _no_handshake;
111         bool     _has_meters;
112         DeviceType _device_type;
113         std::string _name;
114         std::string _global_button_name;
115
116         GlobalButtonsInfo _global_buttons;
117         StripButtonsInfo _strip_buttons;
118
119         void logic_control_buttons ();
120         void mackie_control_buttons ();
121         void shared_buttons ();
122 };
123
124
125 } // Mackie namespace
126 } // ArdourSurface namespace
127
128 std::ostream& operator<< (std::ostream& os, const ArdourSurface::Mackie::DeviceInfo& di);
129
130 #endif /* __ardour_mackie_control_protocol_device_info_h__ */