summaryrefslogtreecommitdiff
path: root/libs/surfaces/mackie
diff options
context:
space:
mode:
Diffstat (limited to 'libs/surfaces/mackie')
-rw-r--r--libs/surfaces/mackie/bcf_surface.cc78
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.cc81
-rw-r--r--libs/surfaces/mackie/mackie_control_protocol.h22
-rw-r--r--libs/surfaces/mackie/scripts/bcf-controls.csv22
4 files changed, 127 insertions, 76 deletions
diff --git a/libs/surfaces/mackie/bcf_surface.cc b/libs/surfaces/mackie/bcf_surface.cc
index 2aaa70fc3e..45b5ad85fa 100644
--- a/libs/surfaces/mackie/bcf_surface.cc
+++ b/libs/surfaces/mackie/bcf_surface.cc
@@ -615,20 +615,13 @@ void Mackie::BcfSurface::init_controls()
group->add( *control );
group = groups["modifiers"];
- control = new Button ( 71, 1, "option", *group );
- buttons[0x47] = control;
+ control = new Button ( 80, 1, "option", *group );
+ buttons[0x50] = control;
controls.push_back( control );
controls_by_name["option"] = control;
group->add( *control );
group = groups["modifiers"];
- control = new Button ( 72, 1, "control", *group );
- buttons[0x48] = control;
- controls.push_back( control );
- controls_by_name["control"] = control;
- group->add( *control );
-
- group = groups["modifiers"];
control = new Button ( 73, 1, "cmd_alt", *group );
buttons[0x49] = control;
controls.push_back( control );
@@ -663,13 +656,6 @@ void Mackie::BcfSurface::init_controls()
controls_by_name["snapshot"] = control;
group->add( *control );
- group = groups["automation"];
- control = new Button ( 78, 1, "touch", *group );
- buttons[0x4e] = control;
- controls.push_back( control );
- controls_by_name["touch"] = control;
- group->add( *control );
-
group = groups["functions"];
control = new Button ( 79, 1, "redo", *group );
buttons[0x4f] = control;
@@ -678,8 +664,8 @@ void Mackie::BcfSurface::init_controls()
group->add( *control );
group = groups["functions"];
- control = new Button ( 80, 1, "marker", *group );
- buttons[0x50] = control;
+ control = new Button ( 71, 1, "marker", *group );
+ buttons[0x47] = control;
controls.push_back( control );
controls_by_name["marker"] = control;
group->add( *control );
@@ -706,15 +692,15 @@ void Mackie::BcfSurface::init_controls()
group->add( *control );
group = groups["transport"];
- control = new Button ( 84, 1, "frm_left", *group );
- buttons[0x54] = control;
+ control = new Button ( 91, 1, "frm_left", *group );
+ buttons[0x5b] = control;
controls.push_back( control );
controls_by_name["frm_left"] = control;
group->add( *control );
group = groups["transport"];
- control = new Button ( 85, 1, "frm_right", *group );
- buttons[0x55] = control;
+ control = new Button ( 92, 1, "frm_right", *group );
+ buttons[0x5c] = control;
controls.push_back( control );
controls_by_name["frm_right"] = control;
group->add( *control );
@@ -727,15 +713,15 @@ void Mackie::BcfSurface::init_controls()
group->add( *control );
group = groups["transport"];
- control = new Button ( 44, 1, "punch_in", *group );
- buttons[0x2c] = control;
+ control = new Button ( 72, 1, "punch_in", *group );
+ buttons[0x48] = control;
controls.push_back( control );
controls_by_name["punch_in"] = control;
group->add( *control );
group = groups["transport"];
- control = new Button ( 43, 1, "punch_out", *group );
- buttons[0x2b] = control;
+ control = new Button ( 78, 1, "punch_out", *group );
+ buttons[0x4e] = control;
controls.push_back( control );
controls_by_name["punch_out"] = control;
group->add( *control );
@@ -755,15 +741,15 @@ void Mackie::BcfSurface::init_controls()
group->add( *control );
group = groups["transport"];
- control = new Button ( 91, 1, "rewind", *group );
- buttons[0x5b] = control;
+ control = new Button ( 44, 1, "rewind", *group );
+ buttons[0x2c] = control;
controls.push_back( control );
controls_by_name["rewind"] = control;
group->add( *control );
group = groups["transport"];
- control = new Button ( 92, 1, "ffwd", *group );
- buttons[0x5c] = control;
+ control = new Button ( 43, 1, "ffwd", *group );
+ buttons[0x2b] = control;
controls.push_back( control );
controls_by_name["ffwd"] = control;
group->add( *control );
@@ -1196,7 +1182,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x47: // option
+ case 0x50: // option
switch ( bs ) {
case press: ls = mbh.option_press( button ); break;
case release: ls = mbh.option_release( button ); break;
@@ -1204,14 +1190,6 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x48: // control
- switch ( bs ) {
- case press: ls = mbh.control_press( button ); break;
- case release: ls = mbh.control_release( button ); break;
- case neither: break;
- }
- break;
-
case 0x49: // cmd_alt
switch ( bs ) {
case press: ls = mbh.cmd_alt_press( button ); break;
@@ -1252,14 +1230,6 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x4e: // touch
- switch ( bs ) {
- case press: ls = mbh.touch_press( button ); break;
- case release: ls = mbh.touch_release( button ); break;
- case neither: break;
- }
- break;
-
case 0x4f: // redo
switch ( bs ) {
case press: ls = mbh.redo_press( button ); break;
@@ -1268,7 +1238,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x50: // marker
+ case 0x47: // marker
switch ( bs ) {
case press: ls = mbh.marker_press( button ); break;
case release: ls = mbh.marker_release( button ); break;
@@ -1300,7 +1270,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x54: // frm_left
+ case 0x5b: // frm_left
switch ( bs ) {
case press: ls = mbh.frm_left_press( button ); break;
case release: ls = mbh.frm_left_release( button ); break;
@@ -1308,7 +1278,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x55: // frm_right
+ case 0x5c: // frm_right
switch ( bs ) {
case press: ls = mbh.frm_right_press( button ); break;
case release: ls = mbh.frm_right_release( button ); break;
@@ -1324,7 +1294,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x2c: // punch_in
+ case 0x48: // punch_in
switch ( bs ) {
case press: ls = mbh.punch_in_press( button ); break;
case release: ls = mbh.punch_in_release( button ); break;
@@ -1332,7 +1302,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x2b: // punch_out
+ case 0x4e: // punch_out
switch ( bs ) {
case press: ls = mbh.punch_out_press( button ); break;
case release: ls = mbh.punch_out_release( button ); break;
@@ -1356,7 +1326,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x5b: // rewind
+ case 0x2c: // rewind
switch ( bs ) {
case press: ls = mbh.rewind_press( button ); break;
case release: ls = mbh.rewind_release( button ); break;
@@ -1364,7 +1334,7 @@ void Mackie::BcfSurface::handle_button( MackieButtonHandler & mbh, ButtonState b
}
break;
- case 0x5c: // ffwd
+ case 0x2b: // ffwd
switch ( bs ) {
case press: ls = mbh.ffwd_press( button ); break;
case release: ls = mbh.ffwd_release( button ); break;
diff --git a/libs/surfaces/mackie/mackie_control_protocol.cc b/libs/surfaces/mackie/mackie_control_protocol.cc
index 81d249588e..15beb275aa 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>
@@ -256,7 +257,9 @@ void MackieControlProtocol::switch_banks( int initial )
int delta = sorted.size() - route_table.size();
if ( initial < 0 || ( delta > 0 && initial > delta ) )
{
+#ifdef DEBUG
cout << "not switching to " << initial << endl;
+#endif
return;
}
_current_initial_bank = initial;
@@ -416,7 +419,9 @@ int MackieControlProtocol::set_active (bool yn)
}
catch( exception & e )
{
+#ifdef DEBUG
cout << "set_active to false because exception caught: " << e.what() << endl;
+#endif
_active = false;
throw;
}
@@ -497,8 +502,10 @@ void MackieControlProtocol::update_global_button( const string & name, LedState
}
else
{
+#ifdef DEBUG
cout << "Button " << name << " not found" << endl;
- }
+#endif
+ }
}
// send messages to surface to set controls to correct values
@@ -674,7 +681,9 @@ void MackieControlProtocol::close()
}
catch ( exception & e )
{
+#ifdef DEBUG
cout << "MackieControlProtocol::close caught exception: " << e.what() << endl;
+#endif
}
for( MackiePorts::iterator it = _ports.begin(); it != _ports.end(); ++it )
@@ -691,7 +700,9 @@ void MackieControlProtocol::close()
}
catch ( exception & e )
{
+#ifdef DEBUG
cout << "MackieControlProtocol::close caught exception: " << e.what() << endl;
+#endif
}
}
@@ -757,7 +768,9 @@ int MackieControlProtocol::set_state( const XMLNode & node )
}
catch ( exception & e )
{
+#ifdef DEBUG
cout << "exception in MackieControlProtocol::set_state: " << e.what() << endl;
+#endif
return -1;
}
}
@@ -1038,7 +1051,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 +1061,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 +1076,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 +1125,36 @@ LedState MackieControlProtocol::record_release( Button & button )
return off;
}
+LedState MackieControlProtocol::rewind_press( Button & button )
+{
+ session->request_transport_speed( -4.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( 4.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
///////////////////////////////////////////
@@ -1133,7 +1176,9 @@ void MackieControlProtocol::notify_parameter_changed( const char * name_str )
}
else
{
+#ifdef DEBUG
cout << "parameter changed: " << name << endl;
+#endif
}
}
@@ -1198,6 +1243,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 +1423,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;
+}
diff --git a/libs/surfaces/mackie/mackie_control_protocol.h b/libs/surfaces/mackie/mackie_control_protocol.h
index d71979b463..de44075262 100644
--- a/libs/surfaces/mackie/mackie_control_protocol.h
+++ b/libs/surfaces/mackie/mackie_control_protocol.h
@@ -124,11 +124,11 @@ class MackieControlProtocol
void update_global_button( const std::string & name, Mackie::LedState );
// transport button handler methods from MackieButtonHandler
- virtual Mackie::LedState rewind_press( Mackie::Button & );
- virtual Mackie::LedState rewind_release( Mackie::Button & );
+ virtual Mackie::LedState frm_left_press( Mackie::Button & );
+ virtual Mackie::LedState frm_left_release( Mackie::Button & );
- virtual Mackie::LedState ffwd_press( Mackie::Button & );
- virtual Mackie::LedState ffwd_release( Mackie::Button & );
+ virtual Mackie::LedState frm_right_press( Mackie::Button & );
+ virtual Mackie::LedState frm_right_release( Mackie::Button & );
virtual Mackie::LedState stop_press( Mackie::Button & );
virtual Mackie::LedState stop_release( Mackie::Button & );
@@ -154,7 +154,13 @@ class MackieControlProtocol
virtual Mackie::LedState end_press( Mackie::Button & );
virtual Mackie::LedState end_release( Mackie::Button & );
- // bank switching button handler methods from MackieButtonHandler
+ virtual Mackie::LedState rewind_press( Mackie::Button & button );
+ virtual Mackie::LedState rewind_release( Mackie::Button & button );
+
+ virtual Mackie::LedState ffwd_press( Mackie::Button & button );
+ virtual Mackie::LedState ffwd_release( Mackie::Button & button );
+
+ // bank switching button handler methods from MackieButtonHandler
virtual Mackie::LedState left_press( Mackie::Button & );
virtual Mackie::LedState left_release( Mackie::Button & );
@@ -172,6 +178,10 @@ class MackieControlProtocol
virtual Mackie::LedState global_solo_press( Mackie::Button & );
virtual Mackie::LedState global_solo_release( Mackie::Button & );
+
+ // function buttons
+ virtual Mackie::LedState marker_press( Mackie::Button & );
+ virtual Mackie::LedState marker_release( Mackie::Button & );
protected:
// create instances of MackiePort, depending on what's found in ardour.rc
@@ -302,6 +312,8 @@ class MackieControlProtocol
bool _polling;
struct pollfd * pfd;
int nfds;
+
+ bool _transport_previously_rolling;
};
#endif // ardour_mackie_control_protocol_h
diff --git a/libs/surfaces/mackie/scripts/bcf-controls.csv b/libs/surfaces/mackie/scripts/bcf-controls.csv
index 6a6d66f6ac..e22965a906 100644
--- a/libs/surfaces/mackie/scripts/bcf-controls.csv
+++ b/libs/surfaces/mackie/scripts/bcf-controls.csv
@@ -49,30 +49,28 @@ button,1,,F15,1,0,0x44
button,1,,F16,1,0,0x45
# turn on/off all solos
button,1,,global_solo,1,0,0x27
-button,1,modifiers,option,1,0,0x47
-button,1,modifiers,control,1,0,0x48
+button,1,modifiers,option,1,0,0x50
button,1,modifiers,cmd_alt,1,0,0x49
button,1,automation,on,1,1,0x4a
button,1,automation,rec_ready,1,1,0x4b
button,1,functions,undo,1,1,0x4c
button,1,automation,snapshot,1,1,0x4d
-button,1,automation,touch,1,1,0x4e
button,1,functions,redo,1,1,0x4f
-button,1,functions,marker,1,1,0x50
+button,1,functions,marker,1,1,0x47
button,1,functions,enter,1,1,0x51
button,1,functions,cancel,1,0,0x52
button,1,functions,mixer,1,0,0x53
-button,1,transport,frm_left,1,1,0x54
-button,1,transport,frm_right,1,1,0x55
+
+# transport buttons
+button,1,transport,frm_left,1,1,0x5b
+button,1,transport,frm_right,1,1,0x5c
button,1,transport,loop,1,1,0x46
-button,1,transport,punch_in,1,1,0x2c
-button,1,transport,punch_out,1,1,0x2b
+button,1,transport,punch_in,1,1,0x48
+button,1,transport,punch_out,1,1,0x4e
button,1,transport,home,1,1,0x2a
button,1,transport,end,1,1,0x29
-
-# transport buttons
-button,1,transport,"rewind",1,1,0x5b
-button,1,transport,"ffwd",1,1,0x5c
+button,1,transport,"rewind",1,1,0x2c
+button,1,transport,"ffwd",1,1,0x2b
button,1,transport,"stop",1,1,0x5d
button,1,transport,"play",1,1,0x5e
button,1,transport,"record",1,1,0x1f