summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie/mackie_control_protocol.cc
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/mackie/mackie_control_protocol.cc')
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc65
1 files changed, 61 insertions, 4 deletions
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 81d249588e..b1c8ef2ff8 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.cc
+++ b/libs/surfaces/mackie/mackie_control_protocol.cc
@@ -37,6 +37,7 @@
#include <midi++/manager.h>
#include <pbd/pthread_utils.h>
#include <pbd/error.h>
+#include <pbd/memento_command.h>
#include <ardour/route.h>
#include <ardour/session.h>
@@ -1038,7 +1039,7 @@ void MackieControlProtocol::poll_automation()
// Transport Buttons
/////////////////////////////////////
-LedState MackieControlProtocol::rewind_press( Button & button )
+LedState MackieControlProtocol::frm_left_press( Button & button )
{
// can use first_mark_before/after as well
Location * loc = session->locations()->first_location_before (
@@ -1048,12 +1049,12 @@ LedState MackieControlProtocol::rewind_press( Button & button )
return on;
}
-LedState MackieControlProtocol::rewind_release( Button & button )
+LedState MackieControlProtocol::frm_left_release( Button & button )
{
return off;
}
-LedState MackieControlProtocol::ffwd_press( Button & button )
+LedState MackieControlProtocol::frm_right_press( Button & button )
{
// can use first_mark_before/after as well
Location * loc = session->locations()->first_location_after (
@@ -1063,7 +1064,7 @@ LedState MackieControlProtocol::ffwd_press( Button & button )
return on;
}
-LedState MackieControlProtocol::ffwd_release( Button & button )
+LedState MackieControlProtocol::frm_right_release( Button & button )
{
return off;
}
@@ -1112,6 +1113,36 @@ LedState MackieControlProtocol::record_release( Button & button )
return off;
}
+LedState MackieControlProtocol::rewind_press( Button & button )
+{
+ session->request_transport_speed( -2.0 );
+ return on;
+}
+
+LedState MackieControlProtocol::rewind_release( Button & button )
+{
+ if ( _transport_previously_rolling )
+ session->request_transport_speed( 1.0 );
+ else
+ session->request_stop();
+ return off;
+}
+
+LedState MackieControlProtocol::ffwd_press( Button & button )
+{
+ session->request_transport_speed( 2.0 );
+ return on;
+}
+
+LedState MackieControlProtocol::ffwd_release( Button & button )
+{
+ if ( _transport_previously_rolling )
+ session->request_transport_speed( 1.0 );
+ else
+ session->request_stop();
+ return off;
+}
+
///////////////////////////////////////////
// Session signals
///////////////////////////////////////////
@@ -1198,6 +1229,8 @@ void MackieControlProtocol::notify_transport_state_changed()
update_global_button( "stop", !session->transport_rolling() );
update_global_button( "loop", session->get_play_loop() );
+ _transport_previously_rolling = session->transport_rolling();
+
// rec is special because it's tristate
Button * rec = reinterpret_cast<Button*>( surface().controls_by_name["record"] );
mcu_port().write( builder.build_led( *rec, record_release( *rec ) ) );
@@ -1376,3 +1409,27 @@ LedState MackieControlProtocol::channel_right_release( Button & button )
{
return off;
}
+
+/////////////////////////////////////
+// Functions
+/////////////////////////////////////
+LedState MackieControlProtocol::marker_press( Button & button )
+{
+ // cut'n'paste from LocationUI::add_new_location()
+ string markername;
+ nframes_t where = session->audible_frame();
+ session->locations()->next_available_name(markername,"mcu");
+ Location *location = new Location (where, where, markername, Location::IsMark);
+ session->begin_reversible_command (_("add marker"));
+ XMLNode &before = session->locations()->get_state();
+ session->locations()->add (location, true);
+ XMLNode &after = session->locations()->get_state();
+ session->add_command (new MementoCommand<Locations>(*(session->locations()), &before, &after));
+ session->commit_reversible_command ();
+ return on;
+}
+
+LedState MackieControlProtocol::marker_release( Button & button )
+{
+ return off;
+}