9acf6e57918a8c3f0a1b251a95e7ba423f235b16
[ardour.git] / libs / surfaces / mackie / device_info.cc
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 #include "pbd/xml++.h"
21
22 #include "device_info.h"
23
24 #include "i18n.h"
25
26 using namespace Mackie;
27 using namespace PBD;
28 using std::string;
29
30 DeviceInfo::DeviceInfo()
31         : _strip_cnt (8)
32         , _has_two_character_display (true)
33         , _has_master_fader (true)
34         , _has_segmented_display (false)
35         , _has_timecode_display (true)
36         , _name (X_("Mackie Control Universal Pro"))
37 {
38         
39 }
40
41 DeviceInfo::DeviceInfo (const XMLNode& node)
42         : _strip_cnt (8)
43         , _has_two_character_display (true)
44         , _has_master_fader (true)
45         , _has_segmented_display (false)
46         , _has_timecode_display (true)
47         , _name (X_("Mackie Control Universal Pro"))
48 {
49         const XMLProperty* prop;
50
51         if ((prop = node.property ("strips")) != 0) {
52                 if ((_strip_cnt = atoi (prop->value())) == 0) {
53                         _strip_cnt = 8;
54                 }
55         }
56
57         if ((prop = node.property ("two-character-display")) != 0) {
58                 _has_two_character_display = string_is_affirmative (prop->value());
59         }
60
61         if ((prop = node.property ("master-fader")) != 0) {
62                 _has_master_fader = string_is_affirmative (prop->value());
63         }
64
65         if ((prop = node.property ("display-segmented")) != 0) {
66                 _has_segmented_display = string_is_affirmative (prop->value());
67         }
68
69         if ((prop = node.property ("timecode-display")) != 0) {
70                 _has_timecode_display = string_is_affirmative (prop->value());
71         }
72
73         if ((prop = node.property ("name")) != 0) {
74                 _name = prop->value();
75         }
76 }
77
78 uint32_t
79 DeviceInfo::strip_cnt() const
80 {
81         return _strip_cnt;
82 }
83
84 bool
85 DeviceInfo::has_master_fader() const
86 {
87         return _has_master_fader;
88 }
89
90 bool
91 DeviceInfo::has_two_character_display() const
92 {
93         return _has_two_character_display;
94 }
95
96 bool
97 DeviceInfo::has_segmented_display() const
98 {
99         return _has_segmented_display;
100 }
101
102 bool
103 DeviceInfo::has_timecode_display () const
104 {
105         return _has_timecode_display;
106 }
107