From f1fd7f6fa47f0b86a7097a32e03129102ae0611a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Mon, 17 Jan 2011 17:53:34 +0000 Subject: some new source git-svn-id: svn://localhost/ardour2/branches/3.0@8523 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/pannable.cc | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 libs/ardour/pannable.cc (limited to 'libs/ardour/pannable.cc') diff --git a/libs/ardour/pannable.cc b/libs/ardour/pannable.cc new file mode 100644 index 0000000000..e2f8ccc30e --- /dev/null +++ b/libs/ardour/pannable.cc @@ -0,0 +1,97 @@ +#include "ardour/automation_control.h" +#include "ardour/automation_list.h" +#include "ardour/pannable.h" +#include "ardour/session.h" + +using namespace ARDOUR; + +Pannable::Pannable (Session& s) + : Automatable (s) + , SessionHandleRef (s) + , pan_azimuth_control (new AutomationControl (s, PanAzimuthAutomation, + boost::shared_ptr(new AutomationList(PanAzimuthAutomation)), "")) + , pan_elevation_control (new AutomationControl (s, PanElevationAutomation, + boost::shared_ptr(new AutomationList(PanElevationAutomation)), "")) + , pan_width_control (new AutomationControl (s, PanWidthAutomation, + boost::shared_ptr(new AutomationList(PanWidthAutomation)), "")) + , pan_frontback_control (new AutomationControl (s, PanFrontBackAutomation, + boost::shared_ptr(new AutomationList(PanFrontBackAutomation)), "")) + , pan_lfe_control (new AutomationControl (s, PanLFEAutomation, + boost::shared_ptr(new AutomationList(PanLFEAutomation)), "")) + , _auto_state (Off) + , _auto_style (Absolute) +{ + add_control (pan_azimuth_control); + add_control (pan_elevation_control); + add_control (pan_width_control); + add_control (pan_frontback_control); + add_control (pan_lfe_control); +} + +void +Pannable::set_automation_state (AutoState state) +{ + if (state != _auto_state) { + _auto_state = state; + + const Controls& c (controls()); + + for (Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) { + boost::shared_ptr ac = boost::dynamic_pointer_cast(ci->second); + if (ac) { + ac->alist()->set_automation_state (state); + } + } + + session().set_dirty (); + automation_state_changed (_auto_state); + } +} + +void +Pannable::set_automation_style (AutoStyle style) +{ + if (style != _auto_style) { + _auto_style = style; + + const Controls& c (controls()); + + for (Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) { + boost::shared_ptr ac = boost::dynamic_pointer_cast(ci->second); + if (ac) { + ac->alist()->set_automation_style (style); + } + } + + session().set_dirty (); + automation_style_changed (); + } +} + +void +Pannable::start_touch (double when) +{ + const Controls& c (controls()); + + for (Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) { + boost::shared_ptr ac = boost::dynamic_pointer_cast(ci->second); + if (ac) { + ac->alist()->start_touch (when); + } + } + g_atomic_int_set (&_touching, 1); +} + +void +Pannable::stop_touch (bool mark, double when) +{ + const Controls& c (controls()); + + for (Controls::const_iterator ci = c.begin(); ci != c.end(); ++ci) { + boost::shared_ptr ac = boost::dynamic_pointer_cast(ci->second); + if (ac) { + ac->alist()->stop_touch (mark, when); + } + } + g_atomic_int_set (&_touching, 0); +} -- cgit v1.2.3