Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <algorithm>
+
#include "pbd/memento_command.h"
#include "ardour/debug.h"
#include "mackie_control_protocol.h"
#include "surface.h"
+#include "fader.h"
#include "i18n.h"
MackieControlProtocol::left_press (Button &)
{
Sorted sorted = get_sorted_routes();
- uint32_t strip_cnt = n_strips ();
+ uint32_t strip_cnt = n_strips ();
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank left with current initial = %1 nstrips = %2 tracks/busses = %3\n",
_current_initial_bank, strip_cnt, sorted.size()));
- if (sorted.size() > strip_cnt) {
- int new_initial = _current_initial_bank - strip_cnt;
- if (new_initial < 0) {
- new_initial = 0;
- }
-
- if (new_initial != int (_current_initial_bank)) {
- switch_banks (new_initial);
- }
-
- return on;
+ if (_current_initial_bank > strip_cnt) {
+ switch_banks (_current_initial_bank - strip_cnt);
} else {
- return flashing;
+ switch_banks (0);
}
+
+ return on;
}
LedState
{
Sorted sorted = get_sorted_routes();
uint32_t strip_cnt = n_strips();
+ uint32_t route_cnt = sorted.size();
DEBUG_TRACE (DEBUG::MackieControl, string_compose ("bank right with current initial = %1 nstrips = %2 tracks/busses = %3\n",
- _current_initial_bank, strip_cnt, sorted.size()));
+ _current_initial_bank, strip_cnt, route_cnt));
- if (sorted.size() > strip_cnt) {
- uint32_t delta = sorted.size() - (strip_cnt + _current_initial_bank);
+ uint32_t new_initial = std::min (_current_initial_bank + strip_cnt, route_cnt - 1);
+ switch_banks (new_initial);
- if (delta > strip_cnt) {
- delta = strip_cnt;
- }
-
- if (delta > 0) {
- switch_banks (_current_initial_bank + delta);
- }
-
- return on;
- } else {
- return flashing;
- }
- return off;
+ return on;
}
LedState
} else {
VerticalZoomInAll (); /* EMIT SIGNAL */
}
+ } else {
+ StepTracksUp (); /* EMIT SIGNAL */
}
return off;
}
} else {
VerticalZoomOutAll (); /* EMIT SIGNAL */
}
+ } else {
+ StepTracksDown (); /* EMIT SIGNAL */
}
return off;
}
Mackie::LedState
MackieControlProtocol::scrub_press (Mackie::Button &)
{
- _scrub_mode = !_scrub_mode;
- return (_scrub_mode ? on : off);
+ if (!surfaces.empty()) {
+ surfaces.front()->next_jog_mode ();
+ }
+ return none;
}
Mackie::LedState
MackieControlProtocol::scrub_release (Mackie::Button &)
{
- return (_scrub_mode ? on : off);
+ return none;
}
LedState
// can use first_mark_before/after as well
unsigned long elapsed = _frm_left_last.restart();
- Location * loc = session->locations()->first_location_before (
- session->transport_frame()
- );
-
+ framepos_t pos = session->locations()->first_mark_before (session->transport_frame());
+
// allow a quick double to go past a previous mark
- if (session->transport_rolling() && elapsed < 500 && loc != 0) {
- Location * loc_two_back = session->locations()->first_location_before (loc->start());
- if (loc_two_back != 0)
- {
- loc = loc_two_back;
+ if (session->transport_rolling() && elapsed < 500 && pos >= 0) {
+ framepos_t pos_two_back = session->locations()->first_mark_before (pos);
+ if (pos_two_back >= 0) {
+ pos = pos_two_back;
}
}
// move to the location, if it's valid
- if (loc != 0) {
- session->request_locate (loc->start(), session->transport_rolling());
+ if (pos >= 0) {
+ session->request_locate (pos, session->transport_rolling());
+ } else {
+ session->request_locate (session->current_start_frame(), session->transport_rolling());
}
return on;
MackieControlProtocol::frm_right_press (Button &)
{
// can use first_mark_before/after as well
- Location * loc = session->locations()->first_location_after (session->transport_frame());
+ framepos_t pos = session->locations()->first_mark_after (session->transport_frame());
- if (loc != 0) {
- session->request_locate (loc->start(), session->transport_rolling());
+ if (pos >= 0) {
+ session->request_locate (pos, session->transport_rolling());
+ } else {
+ session->request_locate (session->current_end_frame(), session->transport_rolling());
}
return on;
again, jump back to where we started last time
*/
- transport_play (session->transport_rolling() == 1.0);
+ transport_play (session->transport_speed() == 1.0);
return none;
}
LedState
MackieControlProtocol::rewind_press (Button &)
{
- rewind ();
+ if (_modifier_state == MODIFIER_CONTROL) {
+ goto_start ();
+ } else {
+ rewind ();
+ }
return none;
}
LedState
MackieControlProtocol::ffwd_press (Button &)
{
- ffwd ();
+ if (_modifier_state == MODIFIER_CONTROL) {
+ goto_end();
+ } else {
+ ffwd ();
+ }
return none;
}
return off;
}
-void
-MackieControlProtocol::f_press (uint32_t fn)
-{
-#if 0
- string action = f_action (0);
- if (!action.empty()) {
- access_action (action);
- }
-#endif
-}
LedState
MackieControlProtocol::F1_press (Button &)
{
- f_press (0);
return off;
}
LedState
LedState
MackieControlProtocol::F2_press (Button &)
{
- f_press (1);
return off;
}
LedState
LedState
MackieControlProtocol::F3_press (Button &)
{
- f_press (2);
return off;
}
LedState
LedState
MackieControlProtocol::F4_press (Button &)
{
- f_press (3);
return off;
}
LedState
LedState
MackieControlProtocol::F5_press (Button &)
{
- f_press (4);
return off;
}
LedState
LedState
MackieControlProtocol::F6_press (Button &)
{
- f_press (5);
return off;
}
LedState
LedState
MackieControlProtocol::F7_press (Button &)
{
- f_press (6);
return off;
}
LedState
LedState
MackieControlProtocol::flip_press (Button &)
{
- set_flip_mode (!_flip_mode);
- return (_flip_mode ? on : off);
+ if (_flip_mode != Normal) {
+ set_flip_mode (Normal);
+ } else {
+ set_flip_mode (Mirror);
+ }
+ return ((_flip_mode != Normal) ? on : off);
}
LedState
MackieControlProtocol::flip_release (Button &)
return off;
}
+LedState
+MackieControlProtocol::master_fader_touch_press (Mackie::Button &)
+{
+ DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_press\n");
+
+ Fader* master_fader = surfaces.front()->master_fader();
+
+ boost::shared_ptr<AutomationControl> ac = master_fader->control ();
+
+ master_fader->set_in_use (true);
+ master_fader->start_touch (transport_frame());
+
+ return none;
+}
+LedState
+MackieControlProtocol::master_fader_touch_release (Mackie::Button &)
+{
+ DEBUG_TRACE (DEBUG::MackieControl, "MackieControlProtocol::master_fader_touch_release\n");
+
+ Fader* master_fader = surfaces.front()->master_fader();
+
+ master_fader->set_in_use (false);
+ master_fader->stop_touch (transport_frame(), true);
+
+ return none;
+}
+
Mackie::LedState
MackieControlProtocol::snapshot_press (Mackie::Button&)
{
Mackie::LedState
MackieControlProtocol::read_press (Mackie::Button&)
{
- return none;
+ _metering_active = !_metering_active;
+ notify_metering_state_changed ();
+ return _metering_active;
}
Mackie::LedState
MackieControlProtocol::read_release (Mackie::Button&)
{
- return none;
+ return _metering_active;
}
Mackie::LedState
MackieControlProtocol::write_press (Mackie::Button&)