From 779ec041b598480d9d1b7595c3dbc605bcb70263 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 27 Nov 2015 16:34:01 -0500 Subject: faderport: basic panning via encoder knob. Doesn't help with 2=>2 panner, where width control is also required --- libs/surfaces/faderport/faderport.cc | 15 ++++++++------- libs/surfaces/faderport/faderport.h | 3 +++ libs/surfaces/faderport/operations.cc | 29 +++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 7 deletions(-) (limited to 'libs/surfaces') diff --git a/libs/surfaces/faderport/faderport.cc b/libs/surfaces/faderport/faderport.cc index d1266bc3e5..6111a4ef95 100644 --- a/libs/surfaces/faderport/faderport.cc +++ b/libs/surfaces/faderport/faderport.cc @@ -44,6 +44,7 @@ #include "ardour/midi_port.h" #include "ardour/midiport_manager.h" #include "ardour/monitor_processor.h" +#include "ardour/profile.h" #include "ardour/rc_configuration.h" #include "ardour/route.h" #include "ardour/session.h" @@ -316,11 +317,9 @@ void FaderPort::encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb) { int delta = 1; - if (pb < 8192) { - cerr << "Encoder right\n"; - } else { + + if (pb >= 8192) { delta = -1; - cerr << "Encoder left\n"; } //knob debouncing and hysteresis. The presonus encoder often sends bursts of events, or goes the wrong direction @@ -357,11 +356,13 @@ FaderPort::encoder_handler (MIDI::Parser &, MIDI::pitchbend_t pb) gain->set_user(val); } } else { //pan / balance - //ToDo + if (!Profile->get_mixbus()) { + ardour_pan (delta); + } else { + mixbus_pan (delta); + } } - } - } void diff --git a/libs/surfaces/faderport/faderport.h b/libs/surfaces/faderport/faderport.h index cb5330f1c0..3af6280e2e 100644 --- a/libs/surfaces/faderport/faderport.h +++ b/libs/surfaces/faderport/faderport.h @@ -278,6 +278,9 @@ class FaderPort : public ARDOUR::ControlProtocol, public AbstractUI pannable = _current_route->pannable (); + + if (!pannable) { + return; + } + + boost::shared_ptr azimuth = pannable->pan_azimuth_control; + + if (!azimuth) { + return; + } + + azimuth->set_value (azimuth->interface_to_internal (azimuth->internal_to_interface (azimuth->get_value()) + (delta / 64.0))); +} + +void +FaderPort::mixbus_pan (int delta) +{ + +} -- cgit v1.2.3