diff options
Diffstat (limited to 'libs/surfaces/mackie/mackie_control_protocol.cc')
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc index cfa6524f70..32be851247 100644 --- a/libs/surfaces/mackie/mackie_control_protocol.cc +++ b/libs/surfaces/mackie/mackie_control_protocol.cc @@ -101,7 +101,7 @@ MackieControlProtocol::MackieControlProtocol (Session& session) , _gui (0) , _zoom_mode (false) , _scrub_mode (false) - , _flip_mode (false) + , _flip_mode (Normal) , _view_mode (Mixer) , _current_selected_track (-1) , _modifier_state (0) @@ -393,7 +393,9 @@ MackieControlProtocol::set_active (bool yn) BaseUI::run (); - create_surfaces (); + if (create_surfaces ()) { + return -1; + } connect_session_signals (); _active = true; update_surfaces (); @@ -606,7 +608,7 @@ MackieControlProtocol::set_profile (const string& profile_name) _device_profile = d->second; } -void +int MackieControlProtocol::set_device (const string& device_name, bool allow_activation) { map<string,DeviceInfo>::iterator d = DeviceInfo::device_info.find (device_name); @@ -615,7 +617,7 @@ MackieControlProtocol::set_device (const string& device_name, bool allow_activat device_name, allow_activation)); if (d == DeviceInfo::device_info.end()) { - return; + return -1; } if (_active) { @@ -629,13 +631,16 @@ MackieControlProtocol::set_device (const string& device_name, bool allow_activat set_active (true); } else { if (_active) { - create_surfaces (); + if (create_surfaces ()) { + return -1; + } switch_banks (0, true); } } + return 0; } -void +int MackieControlProtocol::create_surfaces () { string device_name; @@ -652,7 +657,13 @@ MackieControlProtocol::create_surfaces () for (uint32_t n = 0; n < 1 + _device_info.extenders(); ++n) { - boost::shared_ptr<Surface> surface (new Surface (*this, device_name, n, stype)); + boost::shared_ptr<Surface> surface; + + try { + surface.reset (new Surface (*this, device_name, n, stype)); + } catch (...) { + return -1; + } { Glib::Threads::Mutex::Lock lm (surfaces_lock); @@ -698,6 +709,8 @@ MackieControlProtocol::create_surfaces () g_source_ref (psrc->gobj()); } } + + return 0; } void @@ -1236,7 +1249,7 @@ MackieControlProtocol::midi_input_handler (IOCondition ioc, MIDI::Port* port) } DEBUG_TRACE (DEBUG::MackieControl, string_compose ("data available on %1\n", port->name())); - framepos_t now = session->engine().frame_time(); + framepos_t now = session->engine().sample_time(); port->parse (now); } @@ -1271,11 +1284,11 @@ MackieControlProtocol::set_view_mode (ViewMode m) } void -MackieControlProtocol::set_flip_mode (bool yn) +MackieControlProtocol::set_flip_mode (FlipMode fm) { Glib::Threads::Mutex::Lock lm (surfaces_lock); - _flip_mode = yn; + _flip_mode = fm; for (Surfaces::iterator s = surfaces.begin(); s != surfaces.end(); ++s) { (*s)->update_flip_mode_display (); @@ -1573,14 +1586,17 @@ MackieControlProtocol::set_ipmidi_base (int16_t portnum) } } -void +int MackieControlProtocol::ipmidi_restart () { clear_ports (); clear_surfaces (); - create_surfaces (); + if (create_surfaces ()) { + return -1; + } switch_banks (_current_initial_bank, true); needs_ipmidi_restart = false; + return 0; } void |