2 * Copyright (C) 2011-2016 Paul Davis <paul@linuxaudiosystems.com>
3 * Copyright (C) 2017-2019 Robin Gareus <robin@gareus.org>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include "ardour/pannable.h"
21 #include "ardour/panner.h"
22 #include "ardour/pan_controllable.h"
24 using namespace ARDOUR;
27 PanControllable::actually_set_value (double v, Controllable::GroupControlDisposition group_override)
29 boost::shared_ptr<Panner> p = owner->panner();
32 /* no panner: just do it */
33 AutomationControl::actually_set_value (v, group_override);
39 switch (parameter().type()) {
40 case PanWidthAutomation:
41 can_set = p->clamp_width (v);
43 case PanAzimuthAutomation:
44 can_set = p->clamp_position (v);
46 case PanElevationAutomation:
47 can_set = p->clamp_elevation (v);
54 AutomationControl::actually_set_value (v, group_override);
59 PanControllable::get_user_string () const
62 /* assume PanAzimuthAutomation, 0..1 */
63 float v = get_value ();
65 snprintf(buf, sizeof(buf), "%.0f%%", 100.f * v);
68 return owner->value_as_string (boost::dynamic_pointer_cast<const AutomationControl>(shared_from_this()));