13
0

MCP: make vpots control pan width + direction/position

git-svn-id: svn://localhost/ardour2/branches/3.0@11904 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-04-11 16:21:23 +00:00
parent b98efa7893
commit 20d38b1c25
2 changed files with 21 additions and 11 deletions

View File

@ -83,6 +83,11 @@ class MackieControlProtocol
, public AbstractUI<MackieControlUIRequest>
{
public:
static const int MODIFIER_OPTION;
static const int MODIFIER_CONTROL;
static const int MODIFIER_SHIFT;
static const int MODIFIER_CMDALT;
MackieControlProtocol(ARDOUR::Session &);
virtual ~MackieControlProtocol();
@ -279,6 +284,8 @@ class MackieControlProtocol
ARDOUR::Session & get_session() { return *session; }
void add_in_use_timeout (Mackie::Surface& surface, Mackie::Control& in_use_control, Mackie::Control* touch_control);
int modifier_state();
protected:
// shut down the surface
@ -363,12 +370,6 @@ class MackieControlProtocol
bool _scrub_mode;
bool _flip_mode;
int _current_selected_track;
static const int MODIFIER_OPTION;
static const int MODIFIER_CONTROL;
static const int MODIFIER_SHIFT;
static const int MODIFIER_CMDALT;
int _modifier_state;
typedef std::list<GSource*> PortSources;

View File

@ -520,16 +520,25 @@ Strip::handle_pot (Pot& pot, ControlState& state)
return;
}
boost::shared_ptr<Panner> panner = _route->panner_shell()->panner();
// pan for mono input routes, or stereo linked panners
if (panner) {
double p = panner->position ();
boost::shared_ptr<Pannable> pannable = _route->pannable();
if (pannable) {
boost::shared_ptr<AutomationControl> ac;
if (_surface->mcp().modifier_state() & MackieControlProtocol::MODIFIER_CONTROL) {
ac = pannable->pan_width_control;
} else {
ac = pannable->pan_azimuth_control;
}
double p = ac->get_value();
// calculate new value, and adjust
p += state.delta * state.sign;
p = min (1.0, p);
p = max (0.0, p);
panner->set_position (p);
ac->set_value (p);
}
}