Ardour  9.0-pre0-582-g084a23a80d
us2400/device_info.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Ben Loftis <ben@harrisonconsoles.com>
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_us2400_control_protocol_device_info_h__
20 #define __ardour_us2400_control_protocol_device_info_h__
21 
22 #include <iostream>
23 #include <stdint.h>
24 #include <string>
25 #include <map>
26 
27 #include "button.h"
28 
29 class XMLNode;
30 
31 namespace ArdourSurface {
32 
33 namespace US2400 {
34 
36  std::string label; // visible to user
37  std::string group; // in case we want to present in a GUI
38  int32_t id; // value sent by device
39 
40  GlobalButtonInfo () : id (-1) {}
41  GlobalButtonInfo (const std::string& l, const std::string& g, uint32_t i)
42  : label (l), group (g), id (i) {}
43 };
44 
46  int32_t base_id;
47  std::string name;
48 
49  StripButtonInfo () : base_id (-1) {}
50  StripButtonInfo (uint32_t i, const std::string& n)
51  : base_id (i), name (n) {}
52 };
53 
55 {
56  public:
57  enum DeviceType {
58  MCU = 0x14,
59  MCXT = 0x15,
60  LC = 0x10,
61  LCXT = 0x11,
62  HUI = 0x5
63  };
64 
67 
68  int set_state (const XMLNode&, int version);
69 
70  DeviceType device_type() const { return _device_type; }
71  uint32_t strip_cnt () const;
72  uint32_t extenders() const;
73  uint32_t master_position() const;
75  bool has_master_fader () const;
76  bool has_timecode_display() const;
77  bool has_global_controls() const;
78  bool has_jog_wheel () const;
79  bool has_touch_sense_faders() const;
80  bool no_handshake() const;
81  bool has_meters() const;
82  bool has_separate_meters() const;
83  bool us2400() const { return _us2400; }
84  const std::string& name() const;
85 
86  static std::map<std::string,DeviceInfo> device_info;
87  static void reload_device_info();
88 
91 
92  typedef std::map<Button::ID,GlobalButtonInfo> GlobalButtonsInfo;
93  typedef std::map<Button::ID,StripButtonInfo> StripButtonsInfo;
94 
96  const StripButtonsInfo& strip_buttons() const { return _strip_buttons; }
97 
98  private:
99  uint32_t _strip_cnt;
100  uint32_t _extenders;
112  bool _us2400;
114  std::string _name;
115  std::string _global_button_name;
116 
119 
122  void shared_buttons ();
123 };
124 
125 
126 } // US2400 namespace
127 } // ArdourSurface namespace
128 
129 std::ostream& operator<< (std::ostream& os, const ArdourSurface::US2400::DeviceInfo& di);
130 
131 #endif /* __ardour_us2400_control_protocol_device_info_h__ */
std::string & get_global_button_name(Button::ID)
int set_state(const XMLNode &, int version)
std::map< Button::ID, StripButtonInfo > StripButtonsInfo
const StripButtonsInfo & strip_buttons() const
GlobalButtonInfo & get_global_button(Button::ID)
const std::string & name() const
const GlobalButtonsInfo & global_buttons() const
static std::map< std::string, DeviceInfo > device_info
std::map< Button::ID, GlobalButtonInfo > GlobalButtonsInfo
Definition: xml++.h:114
DebugBits US2400
GlobalButtonInfo(const std::string &l, const std::string &g, uint32_t i)
StripButtonInfo(uint32_t i, const std::string &n)
std::ostream & operator<<(std::ostream &os, const ArdourSurface::US2400::DeviceInfo &di)