remove cruft
[ardour.git] / libs / surfaces / mackie / surface.cc
index 3cf411e64a2eeb407fd8da1921ba448f1ddbe919..6941c68d29dbf93feedc292f6bfabcf6c87e9033 100644 (file)
@@ -384,17 +384,26 @@ Surface::setup_master ()
        }
 
        if (!m) {
-               _master_fader->set_control (boost::shared_ptr<AutomationControl>());
+               if (_master_fader) {
+                       _master_fader->set_control (boost::shared_ptr<AutomationControl>());
+               }
                master_connection.disconnect ();
                return;
        }
 
        if (!_master_fader) {
-               _master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *groups["master"]));
-
                Groups::iterator group_it;
+               Group* master_group;
                group_it = groups.find("master");
 
+               if (group_it == groups.end()) {
+                       groups["master"] = master_group = new Group ("master");
+               } else {
+                       master_group = group_it->second;
+               }
+
+               _master_fader = dynamic_cast<Fader*> (Fader::factory (*this, _mcp.device_info().strip_cnt(), "master", *master_group));
+
                DeviceInfo device_info = _mcp.device_info();
                GlobalButtonInfo master_button = device_info.get_global_button(Button::MasterFaderTouch);
                Button* bb = dynamic_cast<Button*> (Button::factory (
@@ -637,7 +646,7 @@ Surface::handle_midi_controller_message (MIDI::Parser &, MIDI::EventTwoBytes* ev
        }
 
        float delta = 0;
-       if (mcp().main_modifier_state() == MackieControlProtocol::MODIFIER_CONTROL) {
+       if (mcp().main_modifier_state() == MackieControlProtocol::MODIFIER_SHIFT) {
                delta = sign * (ticks / (float) 0xff);
        } else {
                delta = sign * (ticks / (float) 0x3f);
@@ -696,6 +705,13 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count
                }
                break;
 
+       case 0x06:
+               /* Behringer X-Touch Compact: Device Ready
+               */
+               DEBUG_TRACE (DEBUG::MackieControl, string_compose ("Behringer X-Touch Compact ready, current status = %1\n", _active));
+               turn_it_on ();
+               break;
+
        case 0x03: /* LCP Connection Confirmation */
                DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device confirms connection, ardour replies\n");
                if (bytes[4] == 0x10 || bytes[4] == 0x11) {
@@ -708,7 +724,9 @@ Surface::handle_midi_sysex (MIDI::Parser &, MIDI::byte * raw_bytes, size_t count
                DEBUG_TRACE (DEBUG::MackieControl, "Logic Control Device denies connection\n");
                _active = false;
                break;
+
        default:
+               DEBUG_TRACE (DEBUG::MackieControl, string_compose ("unknown device ID byte %1", (int) bytes[5]));
                error << "MCP: unknown sysex: " << bytes << endmsg;
        }
 }
@@ -790,9 +808,9 @@ Surface::turn_it_on ()
 
        update_view_mode_display (false);
 
-       if (_mcp.device_info ().has_global_controls ()) {
-               _mcp.update_global_button (Button::Read, _mcp.metering_active ());
-       }
+//     if (_mcp.device_info ().has_global_controls ()) {
+//             _mcp.update_global_button (Button::Read, _mcp.metering_active ());
+//     }
 }
 
 void
@@ -1019,15 +1037,7 @@ void
 Surface::update_flip_mode_display ()
 {
        for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
-               (*s)->potmode_changed (true);
-       }
-}
-
-void
-Surface::update_potmode ()
-{
-       for (Strips::iterator s = strips.begin(); s != strips.end(); ++s) {
-               (*s)->potmode_changed (false);
+               (*s)->flip_mode_changed ();
        }
 }