#include <float.h>
#include <sys/time.h>
#include <errno.h>
-#include <poll.h>
#include <boost/shared_array.hpp>
, _gui (0)
, _zoom_mode (false)
, _scrub_mode (false)
- , _flip_mode (false)
+ , _flip_mode (Normal)
, _view_mode (Mixer)
, _current_selected_track (-1)
, _modifier_state (0)
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
*/
if (!_device_info.uses_ipmidi()) {
+#ifndef PLATFORM_WINDOWS
CrossThreadChannel::drain (port->selectable());
+#endif
}
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("data available on %1\n", port->name()));
}
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 ();
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