diff options
author | David Robillard <d@drobilla.net> | 2007-04-12 23:20:37 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-04-12 23:20:37 +0000 |
commit | 959a7909c1adca430a63f783fd16687242a7be3d (patch) | |
tree | b5048c3cc1bbb60bb680472b97ebba6ebb92d72f /libs/surfaces/mackie/mackie_control_protocol.cc | |
parent | 96ca08b9257e4048294cd1804a65d4ae6cd88814 (diff) |
Merged with trunk R1705.
Synced .po files with trunk.
Fixed more editor operations to be type agnostic (ie not audio only).
git-svn-id: svn://localhost/ardour2/branches/midi@1709 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/surfaces/mackie/mackie_control_protocol.cc')
-rw-r--r-- | libs/surfaces/mackie/mackie_control_protocol.cc | 65 |
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; +} |