diff options
author | Len Ovens <len@ovenwerks.net> | 2015-06-04 15:07:43 -0700 |
---|---|---|
committer | Len Ovens <len@ovenwerks.net> | 2015-06-04 15:07:43 -0700 |
commit | 71ae8d2abeee34b7f71410821246d43cd3476bb0 (patch) | |
tree | 8e96e4c776e45c65d12ed1ea9157f481aafa651f /libs | |
parent | 71feea97a0894c07d973713f3c23634ddef2f56d (diff) |
Add an option in the MCP .device file to set master position (fixes #6357)
Diffstat (limited to 'libs')
-rw-r--r-- | libs/surfaces/mackie/device_info.cc | 16 | ||||
-rw-r--r-- | libs/surfaces/mackie/device_info.h | 2 | ||||
-rw-r--r-- | libs/surfaces/mackie/surface.cc | 5 |
3 files changed, 21 insertions, 2 deletions
diff --git a/libs/surfaces/mackie/device_info.cc b/libs/surfaces/mackie/device_info.cc index 3ec1369eea..a50d25607a 100644 --- a/libs/surfaces/mackie/device_info.cc +++ b/libs/surfaces/mackie/device_info.cc @@ -46,6 +46,7 @@ std::map<std::string,DeviceInfo> DeviceInfo::device_info; DeviceInfo::DeviceInfo() : _strip_cnt (8) , _extenders (0) + , _master_position (0) , _has_two_character_display (true) , _has_master_fader (true) , _has_timecode_display (true) @@ -241,6 +242,14 @@ DeviceInfo::set_state (const XMLNode& node, int /* version */) } } + if ((child = node.child ("MasterPosition")) != 0) { + if ((prop = child->property ("value")) != 0) { + if ((_master_position = atoi (prop->value().c_str())) == 0) { + _master_position = 0; + } + } + } + if ((child = node.child ("TwoCharacterDisplay")) != 0) { if ((prop = child->property ("value")) != 0) { _has_two_character_display = string_is_affirmative (prop->value()); @@ -387,6 +396,12 @@ DeviceInfo::extenders() const return _extenders; } +uint32_t +DeviceInfo::master_position() const +{ + return _master_position; +} + bool DeviceInfo::has_master_fader() const { @@ -510,6 +525,7 @@ std::ostream& operator<< (std::ostream& os, const Mackie::DeviceInfo& di) os << di.name() << ' ' << di.strip_cnt() << ' ' << di.extenders() << ' ' + << di.master_position() << ' ' ; return os; } diff --git a/libs/surfaces/mackie/device_info.h b/libs/surfaces/mackie/device_info.h index 9a70852ed6..ac24b1cea1 100644 --- a/libs/surfaces/mackie/device_info.h +++ b/libs/surfaces/mackie/device_info.h @@ -62,6 +62,7 @@ class DeviceInfo uint32_t strip_cnt () const; uint32_t extenders() const; + uint32_t master_position() const; bool has_two_character_display() const; bool has_master_fader () const; bool has_timecode_display() const; @@ -88,6 +89,7 @@ class DeviceInfo private: uint32_t _strip_cnt; uint32_t _extenders; + uint32_t _master_position; bool _has_two_character_display; bool _has_master_fader; bool _has_timecode_display; diff --git a/libs/surfaces/mackie/surface.cc b/libs/surfaces/mackie/surface.cc index dc79d5fa27..b918f67025 100644 --- a/libs/surfaces/mackie/surface.cc +++ b/libs/surfaces/mackie/surface.cc @@ -94,8 +94,9 @@ Surface::Surface (MackieControlProtocol& mcp, const std::string& device_name, ui } /* only the first Surface object has global controls */ - - if (_number == 0) { + /* lets use master_position instead */ + uint32_t mp = _mcp.device_info().master_position(); + if (_number == mp) { DEBUG_TRACE (DEBUG::MackieControl, "Surface is first. Might have global controls.\n"); if (_mcp.device_info().has_global_controls()) { init_controls (); |