summaryrefslogtreecommitdiff
path: root/libs/ardour/pannable.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2011-01-17 17:53:34 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2011-01-17 17:53:34 +0000
commitf1fd7f6fa47f0b86a7097a32e03129102ae0611a (patch)
tree8b2cf4c6abbea93f1eadda3238a1cc3541a1fea7 /libs/ardour/pannable.cc
parentc1c14e229e0a5c82e2f9edf7e425589fe156b12d (diff)
some new source
git-svn-id: svn://localhost/ardour2/branches/3.0@8523 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/pannable.cc')
-rw-r--r--libs/ardour/pannable.cc97
1 files changed, 97 insertions, 0 deletions
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<AutomationList>(new AutomationList(PanAzimuthAutomation)), ""))
+ , pan_elevation_control (new AutomationControl (s, PanElevationAutomation,
+ boost::shared_ptr<AutomationList>(new AutomationList(PanElevationAutomation)), ""))
+ , pan_width_control (new AutomationControl (s, PanWidthAutomation,
+ boost::shared_ptr<AutomationList>(new AutomationList(PanWidthAutomation)), ""))
+ , pan_frontback_control (new AutomationControl (s, PanFrontBackAutomation,
+ boost::shared_ptr<AutomationList>(new AutomationList(PanFrontBackAutomation)), ""))
+ , pan_lfe_control (new AutomationControl (s, PanLFEAutomation,
+ boost::shared_ptr<AutomationList>(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<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl>(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<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl>(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<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl>(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<AutomationControl> ac = boost::dynamic_pointer_cast<AutomationControl>(ci->second);
+ if (ac) {
+ ac->alist()->stop_touch (mark, when);
+ }
+ }
+ g_atomic_int_set (&_touching, 0);
+}