Compare commits

...

4 Commits

Author SHA1 Message Date
Paul Davis f5120a46ed avoid direct use of AutomationControl in Mackie code 2015-12-28 13:22:52 -05:00
Paul Davis 017da27fd5 remove unused variable 2015-12-28 12:35:55 -05:00
Paul Davis d747753c0b remove unused variable 2015-12-28 11:17:27 -05:00
Paul Davis 63eb588e42 add ::set_property() API to ARDOUR::Route
this should provide a convenient one-stop shopping interface for
control surfaces that can use libardour (GPL)
2015-12-28 11:15:08 -05:00
6 changed files with 130 additions and 15 deletions

View File

@ -141,6 +141,8 @@ class LIBARDOUR_API Route : public SessionObject, public Automatable, public Rou
void shift (framepos_t, framecnt_t);
void set_property (AutomationType, double val, void* src);
void set_gain (gain_t val, void *src);
void inc_gain (gain_t delta, void *src);

View File

@ -383,6 +383,88 @@ Route::ensure_track_or_route_name(string name, Session &session)
return newname;
}
void
Route::set_property (AutomationType at, double val, void* src)
{
boost::shared_ptr<RouteList> rl;
boost::shared_ptr<AutomationControl> ac;
switch (at) {
case GainAutomation:
/* route must mediate group control */
set_gain (val, src);
break;
case RecEnableAutomation:
/* session must mediate group control */
rl.reset (new RouteList);
rl->push_back (shared_from_this());
_session.set_record_enabled (rl, val >= 0.5 ? true : false);
break;
case SoloAutomation:
/* session must mediate group control */
rl.reset (new RouteList);
rl->push_back (shared_from_this());
if (Config->get_solo_control_is_listen_control()) {
_session.set_listen (rl, val >= 0.5 ? true : false);
} else {
_session.set_solo (rl, val >= 0.5 ? true : false);
}
break;
case MuteAutomation:
/* session must mediate group control */
rl.reset (new RouteList);
rl->push_back (shared_from_this());
_session.set_mute (rl, !muted());
break;
case PanAzimuthAutomation:
/* no mediation necessary */
ac = pan_azimuth_control ();
if (ac) {
ac->set_value (val);
}
break;
case PanElevationAutomation:
/* no mediation necessary */
ac = pan_elevation_control ();
if (ac) {
ac->set_value (val);
}
break;
case PanWidthAutomation:
/* no mediation necessary */
ac = pan_width_control ();
if (ac) {
ac->set_value (val);
}
break;
case PanFrontBackAutomation:
/* no mediation necessary */
ac = pan_frontback_control ();
if (ac) {
ac->set_value (val);
}
break;
case PanLFEAutomation:
/* no mediation necessary */
ac = pan_lfe_control ();
if (ac) {
ac->set_value (val);
}
break;
default:
break;
}
}
void
Route::inc_gain (gain_t fraction, void *src)
{

View File

@ -21,6 +21,7 @@
#include <sstream>
#include "ardour/automation_control.h"
#include "ardour/route.h"
#include "controls.h"
#include "types.h"
@ -53,6 +54,22 @@ Control::Control (int id, std::string name, Group & group)
{
}
void
Control::set_route (boost::shared_ptr<ARDOUR::Route> r)
{
_route = r;
}
ARDOUR::AutomationType
Control::automation_type () const
{
if (!normal_ac) {
return ARDOUR::NullAutomation;
}
return ARDOUR::AutomationType (normal_ac->parameter().type());
}
/** @return true if the control is in use, or false otherwise.
Buttons are `in use' when they are held down.
Faders with touch support are `in use' when they are being touched.
@ -71,18 +88,14 @@ Control::set_in_use (bool in_use)
_in_use = in_use;
}
void
Control::set_control (boost::shared_ptr<AutomationControl> ac)
{
normal_ac = ac;
}
void
Control::set_value (float val)
{
if (normal_ac) {
normal_ac->set_value (normal_ac->interface_to_internal (val));
if (!_route || !normal_ac) {
return;
}
_route->set_property (automation_type(), normal_ac->interface_to_internal (val), this);
}
float

View File

@ -29,11 +29,14 @@
#include "pbd/signals.h"
#include "ardour/types.h"
#include "mackie_control_exception.h"
#include "midi_byte_array.h"
namespace ARDOUR {
class AutomationControl;
class Route;
}
namespace ArdourSurface {
@ -61,14 +64,25 @@ public:
virtual MidiByteArray zero() = 0;
/** If we are doing an in_use timeout for a fader without touch, this
* is its touch button control; otherwise 0.
/* we keep a pointer to an AutomationControl so that we can convert
* easily between interface (GUI) values (normalized to 0..1.0) and
* internal values (whatever range the control itself might have).
*/
Control* in_use_touch_control;
boost::shared_ptr<ARDOUR::AutomationControl> control () const { return normal_ac; }
virtual void set_control (boost::shared_ptr<ARDOUR::AutomationControl>);
/* this is the route (possibly null) which has some kind of parameter
* controlled by this Control
*/
boost::shared_ptr<ARDOUR::Route> route() const { return _route; }
virtual void set_route (boost::shared_ptr<ARDOUR::Route>);
/* this describes the parameter that we control */
ARDOUR::AutomationType automation_type() const;
float get_value ();
void set_value (float val);
@ -83,6 +97,7 @@ public:
std::string _name;
Group& _group;
bool _in_use;
boost::shared_ptr<ARDOUR::Route> _route;
};
}

View File

@ -172,8 +172,6 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
return;
}
mb_pan_controllable.reset();
route_connections.drop_connections ();
_solo->set_control (boost::shared_ptr<AutomationControl>());
@ -185,6 +183,13 @@ Strip::set_route (boost::shared_ptr<Route> r, bool /*with_messages*/)
_route = r;
_solo->set_route (r);
_mute->set_route (r);
_select->set_route (r);
_recenable->set_route (r);
_fader->set_route (r);
_vpot->set_route (r);
control_by_parameter.clear ();
control_by_parameter[PanAzimuthAutomation] = (Control*) 0;

View File

@ -140,8 +140,6 @@ private:
void update_meter ();
std::string vpot_mode_string ();
boost::shared_ptr<ARDOUR::AutomationControl> mb_pan_controllable;
void return_to_vpot_mode_display ();
struct RedisplayRequest {