13
0

faderport: basic panning via encoder knob.

Doesn't help with 2=>2 panner, where width control is also required
This commit is contained in:
Paul Davis 2015-11-27 16:34:01 -05:00
parent b842495be0
commit 779ec041b5
3 changed files with 40 additions and 7 deletions

View File

@ -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

View File

@ -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);
};
}

View File

@ -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)
{
}