diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2015-11-27 16:34:01 -0500 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2015-11-27 16:34:01 -0500 |
commit | 779ec041b598480d9d1b7595c3dbc605bcb70263 (patch) | |
tree | f5e603a0d820c708d0be5c8f5e1db76ad741cfbb /libs/surfaces | |
parent | b842495be0ff781943f35d7fddc718c387d9cf87 (diff) |
faderport: basic panning via encoder knob.
Doesn't help with 2=>2 panner, where width control is also required
Diffstat (limited to 'libs/surfaces')
-rw-r--r-- | libs/surfaces/faderport/faderport.cc | 15 | ||||
-rw-r--r-- | libs/surfaces/faderport/faderport.h | 3 | ||||
-rw-r--r-- | libs/surfaces/faderport/operations.cc | 29 |
3 files changed, 40 insertions, 7 deletions
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<FaderPortReq void solo (); void mute (); void rec_enable (); + + void ardour_pan (int); + void mixbus_pan (int); }; } diff --git a/libs/surfaces/faderport/operations.cc b/libs/surfaces/faderport/operations.cc index fd9930be0c..73a8e25f51 100644 --- a/libs/surfaces/faderport/operations.cc +++ b/libs/surfaces/faderport/operations.cc @@ -19,6 +19,7 @@ #include "ardour/async_midi_port.h" #include "ardour/monitor_processor.h" +#include "ardour/pannable.h" #include "ardour/rc_configuration.h" #include "ardour/session.h" #include "ardour/track.h" @@ -205,3 +206,31 @@ FaderPort::use_monitor () } else { } } + +void +FaderPort::ardour_pan (int delta) +{ + if (!_current_route) { + return; + } + + boost::shared_ptr<Pannable> pannable = _current_route->pannable (); + + if (!pannable) { + return; + } + + boost::shared_ptr<AutomationControl> 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) +{ + +} |