Fix MCP extension number and get master on right surface.
authorLen Ovens <len@ovenwerks.net>
Mon, 12 Oct 2015 04:37:04 +0000 (21:37 -0700)
committerLen Ovens <len@ovenwerks.net>
Mon, 12 Oct 2015 04:37:04 +0000 (21:37 -0700)
libs/surfaces/mackie/mackie_control_protocol.cc
libs/surfaces/mackie/surface_port.cc

index 6f81b57c5998205819d0d3f1bcd554b9a566dd6b..9f9f33b633d484d3690335b5f9cba0f4e58d9c67 100644 (file)
@@ -775,18 +775,7 @@ MackieControlProtocol::create_surfaces ()
        for (uint32_t n = 0; n < 1 + _device_info.extenders(); ++n) {
                bool is_master = false;
 
-               if (_device_info.master_position() == 0) {
-                       /* unspecified master position, use first surface */
-                       if (n == 0) {
-                               is_master = true;
-                               if (_device_info.extenders() == 0) {
-                                       device_name = _device_info.name();
-                               } else {
-                                       device_name = X_("mackie control");
-                               }
-                       }
-               } else if ((n+1) == _device_info.master_position()) {
-                       /* specified master position, uses 1-based counting for user interaction */
+               if (n == _device_info.master_position()) {
                        is_master = true;
                        if (_device_info.extenders() == 0) {
                                device_name = _device_info.name();
@@ -799,10 +788,11 @@ MackieControlProtocol::create_surfaces ()
                if (!is_master) {
                        device_name = string_compose (X_("mackie control ext %1"), n+1);
                }
+       DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Port Name for surface %1 is %2\n", n, device_name));
 
                boost::shared_ptr<Surface> surface;
 
-               if (n == _device_info.master_position()) {
+               if (is_master) {
                        stype = mcu;
                } else {
                        stype = ext;
index 6f243a54449fe06085049d2479d12ec9a9229d7b..009f45d136fdc27d13ae012a035acdc4d0d77ab6 100644 (file)
@@ -62,12 +62,12 @@ SurfacePort::SurfacePort (Surface& s)
                string out_name;
 
                if (_surface->mcp().device_info().extenders() > 0) {
-                       if (_surface->number() + 1 == _surface->mcp().device_info().master_position()) {
+                       if (_surface->number() == _surface->mcp().device_info().master_position()) {
                                in_name = X_("mackie control in");
                                out_name = X_("mackie control out");
                        } else {
-                               in_name = string_compose (X_("mackie control in ext %1"), _surface->number());
-                               out_name = string_compose (X_("mackie control out ext %1"), _surface->number());
+                               in_name = string_compose (X_("mackie control in ext %1"), (_surface->number() + 1));
+                               out_name = string_compose (X_("mackie control out ext %1"), _surface->number() + 1);
                        }
                } else {
                        in_name = X_("mackie control in");