13
0

faderport: output button is a toggle between master (or monitor) and currently used route

This commit is contained in:
Paul Davis 2015-11-25 16:47:20 -05:00
parent 104ec39b50
commit d53993fd83
2 changed files with 22 additions and 2 deletions

View File

@ -103,6 +103,9 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI<FaderPortReq
private: private:
boost::shared_ptr<ARDOUR::Route> _current_route; boost::shared_ptr<ARDOUR::Route> _current_route;
boost::weak_ptr<ARDOUR::Route> pre_master_route;
boost::weak_ptr<ARDOUR::Route> pre_monitor_route;
boost::shared_ptr<ARDOUR::AsyncMIDIPort> _input_port; boost::shared_ptr<ARDOUR::AsyncMIDIPort> _input_port;
boost::shared_ptr<ARDOUR::AsyncMIDIPort> _output_port; boost::shared_ptr<ARDOUR::AsyncMIDIPort> _output_port;

View File

@ -17,6 +17,7 @@
*/ */
#include "ardour/async_midi_port.h"
#include "ardour/rc_configuration.h" #include "ardour/rc_configuration.h"
#include "ardour/session.h" #include "ardour/session.h"
#include "ardour/track.h" #include "ardour/track.h"
@ -91,7 +92,15 @@ FaderPort::use_master ()
{ {
boost::shared_ptr<Route> r = session->master_out(); boost::shared_ptr<Route> r = session->master_out();
if (r) { if (r) {
if (_current_route == r) {
r = pre_master_route.lock();
set_current_route (r); set_current_route (r);
button_info(Output).set_led_state (_output_port, false);
} else {
pre_master_route = boost::weak_ptr<Route> (_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<Route> r = session->monitor_out(); boost::shared_ptr<Route> r = session->monitor_out();
if (r) { if (r) {
if (_current_route == r) {
r = pre_monitor_route.lock();
set_current_route (r); set_current_route (r);
button_info(Output).set_led_state (_output_port, false);
} else {
pre_monitor_route = boost::weak_ptr<Route> (_current_route);
set_current_route (r);
button_info(Output).set_led_state (_output_port, true);
}
} }
} }