13
0

Add an option in the MCP .device file to set master position (fixes #6357)

This commit is contained in:
Len Ovens 2015-06-04 15:07:43 -07:00
parent 71feea97a0
commit 71ae8d2abe
3 changed files with 21 additions and 2 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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 ();