summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-11-28 21:28:54 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-11-28 21:28:54 +0000
commitc7df5f5271be9652ab4bac25a1f8dcb4e4373ba4 (patch)
tree42ad73e522e72db48b0cc76cc80c16c48001a37c /libs/ardour
parentad4e0cd2d1ae55fc2c459486c8e048a15cfa50f0 (diff)
add non-functional meta-controls for 2in/2out panning, to control direction+width. support exists in OSC and MIDI maps. no GUI elements yet
git-svn-id: svn://localhost/ardour2/branches/3.0@8121 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/panner.h14
-rw-r--r--libs/ardour/panner.cc65
-rw-r--r--libs/ardour/plugin_insert.cc5
-rw-r--r--libs/ardour/session_state.cc24
4 files changed, 97 insertions, 11 deletions
diff --git a/libs/ardour/ardour/panner.h b/libs/ardour/ardour/panner.h
index a4b49a9a72..ae70ca2083 100644
--- a/libs/ardour/ardour/panner.h
+++ b/libs/ardour/ardour/panner.h
@@ -279,6 +279,17 @@ public:
return automation_control (Evoral::Parameter (PanAutomation, chan, id));
}
+ boost::shared_ptr<AutomationControl> direction_control () {
+ return automation_control (Evoral::Parameter (PanAutomation, 0, 100));
+ }
+
+ boost::shared_ptr<AutomationControl> width_control () {
+ return automation_control (Evoral::Parameter (PanAutomation, 0, 200));
+ }
+
+ void set_stereo_position (double);
+ void set_stereo_width (double);
+
static std::string value_as_string (double);
private:
@@ -297,7 +308,8 @@ public:
static float current_automation_version_number;
void setup_speakers (uint32_t nouts);
-
+ void setup_meta_controls ();
+
/* old school automation handling */
std::string automation_path;
diff --git a/libs/ardour/panner.cc b/libs/ardour/panner.cc
index 97d911b93d..7d862b1aef 100644
--- a/libs/ardour/panner.cc
+++ b/libs/ardour/panner.cc
@@ -101,7 +101,19 @@ StreamPanner::set_mono (bool yn)
void
StreamPanner::PanControllable::set_value (double val)
{
- streampanner.set_position (AngularVector (direct_control_to_stereo_pan (val), 0.0));
+ switch (parameter().id()) {
+ case 100:
+ /* position */
+ streampanner.get_parent().set_stereo_position (val);
+ break;
+ case 200:
+ /* width */
+ streampanner.get_parent().set_stereo_width (val);
+ break;
+ default:
+ streampanner.set_position (AngularVector (direct_control_to_stereo_pan (val), 0.0));
+ }
+
AutomationControl::set_value(val);
}
@@ -746,6 +758,8 @@ Panner::reset (uint32_t nouts, uint32_t npans)
(*x)->update ();
}
+ setup_meta_controls ();
+
/* must emit Changed here, otherwise the changes to the pan_control below raise further
signals which the GUI is not prepared for until it has seen the Changed here.
*/
@@ -997,13 +1011,12 @@ Panner::set_state (const XMLNode& node, int version)
if (sp->set_state (**niter, version) == 0) {
_streampanners.push_back (sp);
- }
+ }
break;
}
}
-
if (!pan_plugins[i].factory) {
error << string_compose (_("Unknown panner plugin \"%1\" found in pan state - ignored"),
prop->value())
@@ -1019,7 +1032,10 @@ Panner::set_state (const XMLNode& node, int version)
}
}
+ setup_meta_controls ();
+
reset (outputs.size (), num_panners);
+
/* don't try to do old-school automation loading if it wasn't marked as existing */
if ((prop = node.property (X_("automation")))) {
@@ -1029,14 +1045,12 @@ Panner::set_state (const XMLNode& node, int version)
automation_path = Glib::build_filename(_session.automation_dir(), prop->value ());
}
-#ifdef MUST_FIX_PANNER_AUTOMATION
for (niter = nlist.begin(); niter != nlist.end(); ++niter) {
if ((*niter)->name() == X_("Automation")) {
set_automation_xml_state (**niter, Evoral::Parameter (PanAutomation));
}
}
-#endif
-
+
return 0;
}
@@ -1378,3 +1392,42 @@ Panner::setup_speakers (uint32_t nouts)
speakers.add_speaker ((*o).position);
}
}
+
+void
+Panner::set_stereo_width (double val)
+{
+ cerr << "Set stereo width to " << val << endl;
+}
+
+void
+Panner::set_stereo_position (double val)
+{
+ cerr << "Set stereo position to " << val << endl;
+}
+
+void
+Panner::setup_meta_controls ()
+{
+ if (_streampanners.size() != 2 || outputs.size() != 2) {
+ return;
+ }
+
+ /* 2 signals to 2 outputs: provide "classic" controls for easier manipulation.
+
+ The ID numbers used here don't really matter that much, because Parameters are scoped by owner,
+ but they keep us out of the ordinary range of pan-related parameters.
+ */
+
+ Evoral::Parameter lr_param (PanAutomation, 0, 100);
+ Evoral::Parameter width_param (PanAutomation, 0, 200);
+
+ if (!automation_control (lr_param)) {
+ boost::shared_ptr<AutomationControl> c (new StreamPanner::PanControllable (_session, _("lr"), *_streampanners.front(), lr_param));
+ add_control (c);
+ }
+
+ if (!automation_control (width_param)) {
+ boost::shared_ptr<AutomationControl> c (new StreamPanner::PanControllable (_session, _("width"), *_streampanners.front(), width_param));
+ add_control (c);
+ }
+}
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index b65077e868..c852d6b2a9 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -191,7 +191,7 @@ PluginInsert::set_automatable ()
Evoral::Parameter param(*i);
_plugins.front()->get_parameter_descriptor(i->id(), desc);
-
+
/* the Parameter belonging to the actual plugin doesn't have its range set
but we want the Controllable related to this Parameter to have those limits.
*/
@@ -915,8 +915,9 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
string
PluginInsert::describe_parameter (Evoral::Parameter param)
{
- if (param.type() != PluginAutomation)
+ if (param.type() != PluginAutomation) {
return Automatable::describe_parameter(param);
+ }
return _plugins[0]->describe_parameter (param);
}
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 9f87c77009..3e8f56fd3e 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -74,6 +74,7 @@
#include "ardour/audioplaylist.h"
#include "ardour/audioregion.h"
#include "ardour/auditioner.h"
+#include "ardour/automation_control.h"
#include "ardour/buffer.h"
#include "ardour/butler.h"
#include "ardour/configuration.h"
@@ -91,6 +92,7 @@
#include "ardour/midi_source.h"
#include "ardour/midi_track.h"
#include "ardour/named_selection.h"
+#include "ardour/panner.h"
#include "ardour/processor.h"
#include "ardour/port.h"
#include "ardour/region_factory.h"
@@ -2978,9 +2980,27 @@ Session::controllable_by_descriptor (const ControllableDescriptor& desc)
break;
}
- case ControllableDescriptor::Pan:
- /* XXX pan control */
+ case ControllableDescriptor::PanDirection:
+ {
+ boost::shared_ptr<Panner> p = r->panner();
+ cerr << "Looking at panner for " << r->name() << endl;
+ if (p) {
+ c = p->direction_control();
+ cerr << "PAN DIRECTION Bound TO " << c << endl;
+ }
+ break;
+ }
+
+ case ControllableDescriptor::PanWidth:
+ {
+ boost::shared_ptr<Panner> p = r->panner();
+ cerr << "Looking at panner for " << r->name() << endl;
+ if (p) {
+ c = p->width_control();
+ cerr << "PAN WIDTH Bound TO " << c << endl;
+ }
break;
+ }
case ControllableDescriptor::Balance:
/* XXX simple pan control */