From d53993fd834ef6b12f9e3acab43325783fa98784 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 25 Nov 2015 16:47:20 -0500 Subject: [PATCH] faderport: output button is a toggle between master (or monitor) and currently used route --- libs/surfaces/faderport/faderport.h | 3 +++ libs/surfaces/faderport/operations.cc | 21 +++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/libs/surfaces/faderport/faderport.h b/libs/surfaces/faderport/faderport.h index 5fe657c704..d733012ea7 100644 --- a/libs/surfaces/faderport/faderport.h +++ b/libs/surfaces/faderport/faderport.h @@ -103,6 +103,9 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI _current_route; + boost::weak_ptr pre_master_route; + boost::weak_ptr pre_monitor_route; + boost::shared_ptr _input_port; boost::shared_ptr _output_port; diff --git a/libs/surfaces/faderport/operations.cc b/libs/surfaces/faderport/operations.cc index 01b555f575..1fb2810b3a 100644 --- a/libs/surfaces/faderport/operations.cc +++ b/libs/surfaces/faderport/operations.cc @@ -17,6 +17,7 @@ */ +#include "ardour/async_midi_port.h" #include "ardour/rc_configuration.h" #include "ardour/session.h" #include "ardour/track.h" @@ -91,7 +92,15 @@ FaderPort::use_master () { boost::shared_ptr r = session->master_out(); if (r) { - set_current_route (r); + if (_current_route == r) { + r = pre_master_route.lock(); + set_current_route (r); + button_info(Output).set_led_state (_output_port, false); + } else { + pre_master_route = boost::weak_ptr (_current_route); + set_current_route (r); + button_info(Output).set_led_state (_output_port, true); + } } } @@ -100,6 +109,14 @@ FaderPort::use_monitor () { boost::shared_ptr r = session->monitor_out(); if (r) { - set_current_route (r); + if (_current_route == r) { + r = pre_monitor_route.lock(); + set_current_route (r); + button_info(Output).set_led_state (_output_port, false); + } else { + pre_monitor_route = boost::weak_ptr (_current_route); + set_current_route (r); + button_info(Output).set_led_state (_output_port, true); + } } }