handle no audio-output AUs
[ardour.git] / libs / ardour / pannable.cc
index 6dbb5005c23a198622e28efcd9db92c4c45d5a68..d77c8a0e7fb0511acb30e56717abec7afdd30f57 100644 (file)
@@ -21,6 +21,7 @@
 #include "pbd/convert.h"
 #include "pbd/compose.h"
 
+#include "ardour/boost_debug.h"
 #include "ardour/debug.h"
 #include "ardour/automation_control.h"
 #include "ardour/automation_list.h"
@@ -29,7 +30,7 @@
 #include "ardour/pan_controllable.h"
 #include "ardour/session.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace PBD;
@@ -48,6 +49,8 @@ Pannable::Pannable (Session& s)
        , _has_state (false)
        , _responding_to_control_auto_state_change (0)
 {
+       //boost_debug_shared_ptr_mark_interesting (this, "pannable");
+
        add_control (pan_azimuth_control);
        add_control (pan_elevation_control);
        add_control (pan_width_control);
@@ -182,8 +185,9 @@ Pannable::get_state ()
 }
 
 XMLNode&
-Pannable::state (bool full)
+Pannable::state (bool /*full*/)
 {
+       LocaleGuard lg;
        XMLNode* node = new XMLNode (X_("Pannable"));
 
        node->add_child_nocopy (pan_azimuth_control->get_state());
@@ -210,7 +214,7 @@ Pannable::set_state (const XMLNode& root, int version)
 
        for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
                if ((*niter)->name() == Controllable::xml_node_name) {
-                       const XMLProperty* prop = (*niter)->property (X_("name"));
+                       XMLProperty const * prop = (*niter)->property (X_("name"));
 
                        if (!prop) {
                                continue;
@@ -230,6 +234,38 @@ Pannable::set_state (const XMLNode& root, int version)
 
                } else if ((*niter)->name() == Automatable::xml_node_name) {
                        set_automation_xml_state (**niter, PanAzimuthAutomation);
+
+               } else {
+                       XMLProperty const * prop;
+
+                       /* old school (alpha1-6) XML info */
+
+                       if ((*niter)->name() == X_("azimuth")) {
+                               prop = (*niter)->property (X_("value"));
+                               if (prop) {
+                                       pan_azimuth_control->set_value (atof (prop->value()), Controllable::NoGroup);
+                               }
+                       } else if ((*niter)->name() == X_("width")) {
+                               prop = (*niter)->property (X_("value"));
+                               if (prop) {
+                                       pan_width_control->set_value (atof (prop->value()), Controllable::NoGroup);
+                               }
+                       } else if ((*niter)->name() == X_("elevation")) {
+                               prop = (*niter)->property (X_("value"));
+                               if (prop) {
+                                       pan_elevation_control->set_value (atof (prop->value()), Controllable::NoGroup);
+                               }
+                       } else if ((*niter)->name() == X_("frontback")) {
+                               prop = (*niter)->property (X_("value"));
+                               if (prop) {
+                                       pan_frontback_control->set_value (atof (prop->value()), Controllable::NoGroup);
+                               }
+                       } else if ((*niter)->name() == X_("lfe")) {
+                               prop = (*niter)->property (X_("value"));
+                               if (prop) {
+                                       pan_lfe_control->set_value (atof (prop->value()), Controllable::NoGroup);
+                               }
+                       }
                }
        }
 
@@ -239,7 +275,7 @@ Pannable::set_state (const XMLNode& root, int version)
 }
 
 string
-Pannable::value_as_string (boost::shared_ptr<AutomationControl> ac) const
+Pannable::value_as_string (boost::shared_ptr<const AutomationControl> ac) const
 {
        boost::shared_ptr<Panner> p = panner ();