13
0

Don't crash if master fader is not avaliable.

If the wrong device profile is selected (ex Xtouch One) but another device
is connected (Xtouch), it is possible to have a master fader on the
device, but not in the code. This would then cause a crash when the
master fader was touched.

This just protects from a wrong configuration.
This commit is contained in:
Todd Naugle 2021-05-13 12:07:41 -05:00
parent ffcf90eacb
commit 3a3fcd0d2d

View File

@ -860,27 +860,29 @@ MackieControlProtocol::user_b_release (Button &)
LedState LedState
MackieControlProtocol::master_fader_touch_press (Mackie::Button &) MackieControlProtocol::master_fader_touch_press (Mackie::Button &)
{ {
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_press\n"); if (_master_surface && _master_surface->master_fader() != 0) {
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_press\n");
Fader* master_fader = _master_surface->master_fader(); Fader* master_fader = _master_surface->master_fader();
boost::shared_ptr<AutomationControl> ac = master_fader->control (); boost::shared_ptr<AutomationControl> ac = master_fader->control ();
master_fader->set_in_use (true);
master_fader->start_touch (transport_sample());
master_fader->set_in_use (true);
master_fader->start_touch (transport_sample());
}
return none; return none;
} }
LedState LedState
MackieControlProtocol::master_fader_touch_release (Mackie::Button &) MackieControlProtocol::master_fader_touch_release (Mackie::Button &)
{ {
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_release\n"); if (_master_surface && _master_surface->master_fader() != 0) {
DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_release\n");
Fader* master_fader = _master_surface->master_fader(); Fader* master_fader = _master_surface->master_fader();
master_fader->set_in_use (false);
master_fader->stop_touch (transport_sample());
master_fader->set_in_use (false);
master_fader->stop_touch (transport_sample());
}
return none; return none;
} }