summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/ardour/ardour/plugin_insert.h6
-rw-r--r--libs/ardour/ardour/readonly_control.h44
-rw-r--r--libs/ardour/plugin_insert.cc19
-rw-r--r--libs/ardour/readonly_control.cc50
-rw-r--r--libs/ardour/wscript1
5 files changed, 119 insertions, 1 deletions
diff --git a/libs/ardour/ardour/plugin_insert.h b/libs/ardour/ardour/plugin_insert.h
index 2b8d1bc542..b801207eaa 100644
--- a/libs/ardour/ardour/plugin_insert.h
+++ b/libs/ardour/ardour/plugin_insert.h
@@ -34,6 +34,7 @@
#include "ardour/parameter_descriptor.h"
#include "ardour/plugin.h"
#include "ardour/processor.h"
+#include "ardour/readonly_control.h"
#include "ardour/sidechain.h"
#include "ardour/automation_control.h"
@@ -243,6 +244,8 @@ class LIBARDOUR_API PluginInsert : public Processor
PluginType type ();
+ boost::shared_ptr<ReadOnlyControl> control_output (uint32_t) const;
+
std::string describe_parameter (Evoral::Parameter param);
framecnt_t signal_latency () const;
@@ -375,6 +378,9 @@ class LIBARDOUR_API PluginInsert : public Processor
bool _latency_changed;
uint32_t _bypass_port;
+ typedef std::map<uint32_t, boost::shared_ptr<ReadOnlyControl> >CtrlOutMap;
+ CtrlOutMap _control_outputs;
+
void preset_load_set_value (uint32_t, float);
};
diff --git a/libs/ardour/ardour/readonly_control.h b/libs/ardour/ardour/readonly_control.h
new file mode 100644
index 0000000000..8a2901af68
--- /dev/null
+++ b/libs/ardour/ardour/readonly_control.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2000, 2007 Paul Davis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __ardour_readonly_control_h__
+#define __ardour_readonly_control_h__
+
+#include <boost/weak_ptr.hpp>
+
+namespace ARDOUR {
+
+class Plugin;
+
+class LIBARDOUR_API ReadOnlyControl : public PBD::Destructible
+{
+public:
+ ReadOnlyControl (boost::shared_ptr<Plugin> p, uint32_t pnum);
+
+ double get_parameter () const;
+ std::string describe_parameter ();
+
+private:
+ boost::weak_ptr<Plugin> _plugin;
+ uint32_t _parameter_num;
+};
+
+} // namespace ARDOUR
+
+#endif /* __ardour_readonly_control_h__ */
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index 7196a6d844..e9bea95dc9 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -98,6 +98,9 @@ PluginInsert::PluginInsert (Session& s, boost::shared_ptr<Plugin> plug)
PluginInsert::~PluginInsert ()
{
+ for (CtrlOutMap::const_iterator i = _control_outputs.begin(); i != _control_outputs.end(); ++i) {
+ boost::dynamic_pointer_cast<ReadOnlyControl>(i->second)->drop_references ();
+ }
}
void
@@ -452,7 +455,11 @@ PluginInsert::create_automatable_parameters ()
set<Evoral::Parameter> a = _plugins.front()->automatable ();
for (uint32_t i = 0; i < plugin->parameter_count(); ++i) {
- if (!plugin->parameter_is_control (i) || !plugin->parameter_is_input (i)) {
+ if (!plugin->parameter_is_control (i)) {
+ continue;
+ }
+ if (!plugin->parameter_is_input (i)) {
+ _control_outputs[i] = boost::shared_ptr<ReadOnlyControl> (new ReadOnlyControl (plugin, i));
continue;
}
Evoral::Parameter param (PluginAutomation, 0, i);
@@ -2803,6 +2810,16 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
}
}
+boost::shared_ptr<ReadOnlyControl>
+PluginInsert::control_output (uint32_t num) const
+{
+ CtrlOutMap::const_iterator i = _control_outputs.find (num);
+ if (i == _control_outputs.end ()) {
+ return boost::shared_ptr<ReadOnlyControl> ();
+ } else {
+ return (*i).second;
+ }
+}
string
PluginInsert::describe_parameter (Evoral::Parameter param)
diff --git a/libs/ardour/readonly_control.cc b/libs/ardour/readonly_control.cc
new file mode 100644
index 0000000000..3b72ac5e1b
--- /dev/null
+++ b/libs/ardour/readonly_control.cc
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2017 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2000, 2007 Paul Davis
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "pbd/destructible.h"
+
+#include "ardour/plugin.h"
+#include "ardour/readonly_control.h"
+
+using namespace ARDOUR;
+
+ReadOnlyControl::ReadOnlyControl (boost::shared_ptr<Plugin> p, uint32_t pnum)
+ : _plugin (boost::weak_ptr<Plugin> (p))
+ , _parameter_num (pnum)
+{ }
+
+double
+ReadOnlyControl::get_parameter () const
+{
+ boost::shared_ptr<Plugin> p = _plugin.lock();
+ if (p) {
+ return p->get_parameter (_parameter_num);
+ }
+ return 0;
+}
+
+std::string
+ReadOnlyControl::describe_parameter ()
+{
+ boost::shared_ptr<Plugin> p = _plugin.lock();
+ if (p) {
+ return p->describe_parameter (Evoral::Parameter (ARDOUR::PluginAutomation, 0, _parameter_num));
+ }
+ return "";
+}
diff --git a/libs/ardour/wscript b/libs/ardour/wscript
index 31eab1cd0c..1098477426 100644
--- a/libs/ardour/wscript
+++ b/libs/ardour/wscript
@@ -178,6 +178,7 @@ libardour_sources = [
'progress.cc',
'quantize.cc',
'rc_configuration.cc',
+ 'readonly_control.cc',
'recent_sessions.cc',
'record_enable_control.cc',
'record_safe_control.cc',