- // TODO what happens if this fails half way?
-
- // create MackiePorts
- {
- Glib::Mutex::Lock lock (update_mutex);
- create_ports();
- }
-
- // now initialise MackiePorts - ie exchange sysex messages
- for (MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it) {
- (*it)->open();
- }
-
- // wait until all ports are active
- // TODO a more sophisticated approach would
- // allow things to start up with only an MCU, even if
- // extenders were specified but not responding.
- for (MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it) {
- (*it)->wait_for_init();
- }
-
- // create surface object. This depends on the ports being
- // correctly initialised
- initialize_surface();
- connect_session_signals();
-
- // yeehah!
- _active = true;
-
- // send current control positions to surface
- // must come after _active = true otherwise it won't run
- update_surface();
- } else {
- close();
- _active = false;