BaseUI::run ();
- create_surfaces ();
+ if (create_surfaces ()) {
+ return -1;
+ }
connect_session_signals ();
_active = true;
update_surfaces ();
_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);
device_name, allow_activation));
if (d == DeviceInfo::device_info.end()) {
- return;
+ return -1;
}
if (_active) {
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;
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);
g_source_ref (psrc->gobj());
}
}
+
+ return 0;
}
void
}
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);
}
void
MackieControlProtocol::remove_down_select_button (int surface, int strip)
{
- DownButtonList::iterator x = find (_down_select_buttons.begin(), _down_select_buttons.end(), (surface<<8)|(strip&0xf));
+ DownButtonList::iterator x = find (_down_select_buttons.begin(), _down_select_buttons.end(), (uint32_t) (surface<<8)|(strip&0xf));
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("removing surface %1 strip %2 from down select buttons\n", surface, strip));
if (x != _down_select_buttons.end()) {
_down_select_buttons.erase (x);
}
}
-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