summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie/device_info.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2012-04-12 16:41:07 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2012-04-12 16:41:07 +0000
commit0c4fe26b4111e5c7955380d9a7ab55c4c775d6d0 (patch)
tree873e07f1ef5fe386bbebf1cdb259793ca2d62913 /libs/surfaces/mackie/device_info.cc
parent62620122a96af73c9714c4de492c43382c5f0297 (diff)
MCP: switch devices on the fly; name MIDI ports appropriately; fix active state; move sysex parsing into Surface
git-svn-id: svn://localhost/ardour2/branches/3.0@11942 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces/mackie/device_info.cc')
-rw-r--r--libs/surfaces/mackie/device_info.cc62
1 files changed, 47 insertions, 15 deletions
diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc
index 446f5dd34d..566a01be9a 100644
--- a/libs/surfaces/mackie/device_info.cc
+++ b/libs/surfaces/mackie/device_info.cc
@@ -58,45 +58,61 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */)
{
const XMLProperty* prop;
const XMLNode* child;
-
+
+ if (node.name() != "MackieProtocolDevice") {
+ return -1;
+ }
+
+ /* name is mandatory */
+
+ if ((child = node.child ("Name")) != 0) {
+ if ((prop = child->property ("value")) != 0) {
+ _name = prop->value();
+ } else {
+ return -1;
+ }
+ }
+
if ((child = node.child ("Strips")) != 0) {
- if ((prop = node.property ("value")) != 0) {
+ if ((prop = child->property ("value")) != 0) {
if ((_strip_cnt = atoi (prop->value())) == 0) {
_strip_cnt = 8;
}
}
}
+ if ((child = node.child ("Extenders")) != 0) {
+ if ((prop = child->property ("value")) != 0) {
+ if ((_extenders = atoi (prop->value())) == 0) {
+ _extenders = 0;
+ }
+ }
+ }
+
if ((child = node.child ("TwoCharacterDisplay")) != 0) {
- if ((prop = node.property ("value")) != 0) {
+ if ((prop = child->property ("value")) != 0) {
_has_two_character_display = string_is_affirmative (prop->value());
}
}
if ((child = node.child ("MasterFader")) != 0) {
- if ((prop = node.property ("value")) != 0) {
+ if ((prop = child->property ("value")) != 0) {
_has_master_fader = string_is_affirmative (prop->value());
}
}
if ((child = node.child ("DisplaySegments")) != 0) {
- if ((prop = node.property ("value")) != 0) {
+ if ((prop = child->property ("value")) != 0) {
_has_segmented_display = string_is_affirmative (prop->value());
}
}
if ((child = node.child ("TimecodeDisplay")) != 0) {
- if ((prop = node.property ("value")) != 0) {
+ if ((prop = child->property ("value")) != 0) {
_has_timecode_display = string_is_affirmative (prop->value());
}
}
- if ((child = node.child ("Name")) != 0) {
- if ((prop = node.property ("value")) != 0) {
- _name = prop->value();
- }
- }
-
return 0;
}
@@ -112,6 +128,12 @@ DeviceInfo::strip_cnt() const
return _strip_cnt;
}
+uint32_t
+DeviceInfo::extenders() const
+{
+ return _extenders;
+}
+
bool
DeviceInfo::has_master_fader() const
{
@@ -207,6 +229,7 @@ DeviceInfo::reload_device_info ()
XMLTree tree;
+
if (!tree.read (fullpath.c_str())) {
continue;
}
@@ -216,11 +239,20 @@ DeviceInfo::reload_device_info ()
continue;
}
- di.set_state (*root, 3000); /* version is ignored for now */
-
- device_info[di.name()] = di;
+ if (di.set_state (*root, 3000) == 0) { /* version is ignored for now */
+ device_info[di.name()] = di;
+ std::cerr << di << '\n';
+ }
}
delete devinfos;
}
+std::ostream& operator<< (std::ostream& os, const Mackie::DeviceInfo& di)
+{
+ os << di.name() << ' '
+ << di.strip_cnt() << ' '
+ << di.extenders() << ' '
+ ;
+ return os;
+}