summaryrefslogtreecommitdiff
path: root/libs/ardour
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2014-10-31 23:48:27 -0400
committerDavid Robillard <d@drobilla.net>2014-11-02 02:10:24 -0500
commit6dfb11c2d08201f1a27818955707590b762f5a40 (patch)
treea0ba48815d3a40bb8491b940d97d3c2330cb19f3 /libs/ardour
parentbd6ba1717ef43bd4399b96a03bbb576eab55b9a2 (diff)
Move ParameterDescriptor from Plugin to its own header.
This fixes circular dependency issues that arise when using ParameterDescriptor more widely.
Diffstat (limited to 'libs/ardour')
-rw-r--r--libs/ardour/ardour/audio_unit.h2
-rw-r--r--libs/ardour/ardour/ladspa_plugin.h2
-rw-r--r--libs/ardour/ardour/lv2_plugin.h2
-rw-r--r--libs/ardour/ardour/parameter_descriptor.h74
-rw-r--r--libs/ardour/ardour/plugin.h42
-rw-r--r--libs/ardour/ardour/variant.h1
-rw-r--r--libs/ardour/ladspa_plugin.cc6
-rw-r--r--libs/ardour/lv2_plugin.cc11
-rw-r--r--libs/ardour/plugin_insert.cc6
9 files changed, 93 insertions, 53 deletions
diff --git a/libs/ardour/ardour/audio_unit.h b/libs/ardour/ardour/audio_unit.h
index 8233e208d3..d840c258e7 100644
--- a/libs/ardour/ardour/audio_unit.h
+++ b/libs/ardour/ardour/audio_unit.h
@@ -48,7 +48,7 @@ namespace ARDOUR {
class AudioEngine;
class Session;
-struct LIBARDOUR_API AUParameterDescriptor : public Plugin::ParameterDescriptor {
+struct LIBARDOUR_API AUParameterDescriptor : public ParameterDescriptor {
// additional fields to make operations more efficient
AudioUnitParameterID id;
AudioUnitScope scope;
diff --git a/libs/ardour/ardour/ladspa_plugin.h b/libs/ardour/ardour/ladspa_plugin.h
index 473953e221..cdcd9dbc6e 100644
--- a/libs/ardour/ardour/ladspa_plugin.h
+++ b/libs/ardour/ardour/ladspa_plugin.h
@@ -96,7 +96,7 @@ class LIBARDOUR_API LadspaPlugin : public ARDOUR::Plugin
bool parameter_is_output(uint32_t) const;
bool parameter_is_toggled(uint32_t) const;
- boost::shared_ptr<Plugin::ScalePoints>
+ boost::shared_ptr<ScalePoints>
get_scale_points(uint32_t port_index) const;
int set_state (const XMLNode&, int version);
diff --git a/libs/ardour/ardour/lv2_plugin.h b/libs/ardour/ardour/lv2_plugin.h
index 9e0bebad5a..82912a947d 100644
--- a/libs/ardour/ardour/lv2_plugin.h
+++ b/libs/ardour/ardour/lv2_plugin.h
@@ -116,7 +116,7 @@ class LIBARDOUR_API LV2Plugin : public ARDOUR::Plugin, public ARDOUR::Workee
bool parameter_is_output (uint32_t) const;
bool parameter_is_toggled (uint32_t) const;
- boost::shared_ptr<Plugin::ScalePoints>
+ boost::shared_ptr<ScalePoints>
get_scale_points(uint32_t port_index) const;
void set_insert_info(const PluginInsert* insert);
diff --git a/libs/ardour/ardour/parameter_descriptor.h b/libs/ardour/ardour/parameter_descriptor.h
new file mode 100644
index 0000000000..a6315ae429
--- /dev/null
+++ b/libs/ardour/ardour/parameter_descriptor.h
@@ -0,0 +1,74 @@
+/*
+ Copyright (C) 2014 Paul Davis
+ Author: David Robillard
+
+ 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.,
+ 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef __ardour_parameter_descriptor_h__
+#define __ardour_parameter_descriptor_h__
+
+#include "ardour/variant.h"
+
+namespace ARDOUR {
+
+typedef std::map<const std::string, const float> ScalePoints;
+
+/** Descriptor of a parameter or control.
+ *
+ * Essentially a union of LADSPA, VST and LV2 info.
+ */
+struct ParameterDescriptor
+{
+ ParameterDescriptor()
+ : key((uint32_t)-1)
+ , datatype(Variant::VOID)
+ , lower(0)
+ , upper(0)
+ , step(0)
+ , smallstep(0)
+ , largestep(0)
+ , integer_step(false)
+ , toggled(false)
+ , logarithmic(false)
+ , sr_dependent(false)
+ , min_unbound(0)
+ , max_unbound(0)
+ , enumeration(false)
+ , midinote(false)
+ {}
+
+ std::string label;
+ boost::shared_ptr<ScalePoints> scale_points;
+ uint32_t key; ///< for properties
+ Variant::Type datatype; ///< for properties
+ float lower; ///< for frequencies, this is in Hz (not a fraction of the sample rate)
+ float upper; ///< for frequencies, this is in Hz (not a fraction of the sample rate)
+ float step;
+ float smallstep;
+ float largestep;
+ bool integer_step;
+ bool toggled;
+ bool logarithmic;
+ bool sr_dependent;
+ bool min_unbound;
+ bool max_unbound;
+ bool enumeration;
+ bool midinote; ///< only used if integer_step is also true
+};
+
+} // namespace ARDOUR
+
+#endif // __ardour_parameter_descriptor_h__
diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h
index f1a54b073a..dc7dbf68e1 100644
--- a/libs/ardour/ardour/plugin.h
+++ b/libs/ardour/ardour/plugin.h
@@ -32,6 +32,7 @@
#include "ardour/latent.h"
#include "ardour/libardour_visibility.h"
#include "ardour/midi_state_tracker.h"
+#include "ardour/parameter_descriptor.h"
#include "ardour/plugin_insert.h"
#include "ardour/types.h"
#include "ardour/variant.h"
@@ -95,47 +96,6 @@ class LIBARDOUR_API Plugin : public PBD::StatefulDestructible, public Latent
Plugin (const Plugin&);
virtual ~Plugin ();
- typedef std::map<const std::string, const float> ScalePoints;
-
- struct ParameterDescriptor {
-
- ParameterDescriptor ()
- : integer_step(false)
- , toggled (false)
- , logarithmic (false)
- , sr_dependent (false)
- , lower (0)
- , upper (0)
- , step (0)
- , smallstep (0)
- , largestep (0)
- , min_unbound (0)
- , max_unbound (0)
- , enumeration (false)
- , midinote(false)
- {}
-
- /* essentially a union of LADSPA, VST and LV2 info */
-
- bool integer_step;
- bool toggled;
- bool logarithmic;
- bool sr_dependent;
- std::string label;
- float lower; ///< if this is a frequency, it will be in Hz (not a fraction of the sample rate)
- float upper; ///< if this is a frequency, it will be in Hz (not a fraction of the sample rate)
- float step;
- float smallstep;
- float largestep;
- bool min_unbound;
- bool max_unbound;
- bool enumeration;
- bool midinote; ///< only used if integer_step is also true
- uint32_t key; ///< for properties
- Variant::Type datatype; ///< for properties
- boost::shared_ptr<ScalePoints> scale_points;
- };
-
XMLNode& get_state ();
virtual int set_state (const XMLNode &, int version);
diff --git a/libs/ardour/ardour/variant.h b/libs/ardour/ardour/variant.h
index 00b9c3acf8..1e9dda179a 100644
--- a/libs/ardour/ardour/variant.h
+++ b/libs/ardour/ardour/variant.h
@@ -34,6 +34,7 @@ class LIBARDOUR_API Variant
{
public:
enum Type {
+ VOID, ///< Nothing
BOOL, ///< Boolean
DOUBLE, ///< C double (64-bit IEEE-754)
FLOAT, ///< C float (32-bit IEEE-754)
diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc
index a33e7e0911..4866516b1a 100644
--- a/libs/ardour/ladspa_plugin.cc
+++ b/libs/ardour/ladspa_plugin.cc
@@ -642,10 +642,10 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const
}
}
-boost::shared_ptr<Plugin::ScalePoints>
+boost::shared_ptr<ScalePoints>
LadspaPlugin::get_scale_points(uint32_t port_index) const
{
- boost::shared_ptr<Plugin::ScalePoints> ret;
+ boost::shared_ptr<ScalePoints> ret;
#ifdef HAVE_LRDF
const uint32_t id = atol(unique_id().c_str());
lrdf_defaults* points = lrdf_get_scale_values(id, port_index);
@@ -654,7 +654,7 @@ LadspaPlugin::get_scale_points(uint32_t port_index) const
return ret;
}
- ret = boost::shared_ptr<Plugin::ScalePoints>(new ScalePoints());
+ ret = boost::shared_ptr<ScalePoints>(new ScalePoints());
for (uint32_t i = 0; i < points->count; ++i) {
ret->insert(make_pair(points->items[i].label,
diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc
index ac4e213851..4f41b51d1b 100644
--- a/libs/ardour/lv2_plugin.cc
+++ b/libs/ardour/lv2_plugin.cc
@@ -1224,6 +1224,8 @@ static void
forge_variant(LV2_Atom_Forge* forge, const Variant& value)
{
switch (value.type()) {
+ case Variant::VOID:
+ break;
case Variant::BOOL:
lv2_atom_forge_bool(forge, value.get_bool());
break;
@@ -1286,6 +1288,9 @@ LV2Plugin::set_property(uint32_t key, const Variant& value)
if (_patch_port_in_index == (uint32_t)-1) {
error << "LV2: set_property called with unset patch_port_in_index" << endmsg;
return;
+ } else if (value.type() == Variant::VOID) {
+ error << "LV2: set_property called with void value" << endmsg;
+ return;
}
// Set up forge to write to temporary buffer on the stack
@@ -2085,18 +2090,18 @@ LV2Plugin::print_parameter(uint32_t param, char* buf, uint32_t len) const
}
}
-boost::shared_ptr<Plugin::ScalePoints>
+boost::shared_ptr<ScalePoints>
LV2Plugin::get_scale_points(uint32_t port_index) const
{
const LilvPort* port = lilv_plugin_get_port_by_index(_impl->plugin, port_index);
LilvScalePoints* points = lilv_port_get_scale_points(_impl->plugin, port);
- boost::shared_ptr<Plugin::ScalePoints> ret;
+ boost::shared_ptr<ScalePoints> ret;
if (!points) {
return ret;
}
- ret = boost::shared_ptr<Plugin::ScalePoints>(new ScalePoints());
+ ret = boost::shared_ptr<ScalePoints>(new ScalePoints());
LILV_FOREACH(scale_points, i, points) {
const LilvScalePoint* p = lilv_scale_points_get(points, i);
diff --git a/libs/ardour/plugin_insert.cc b/libs/ardour/plugin_insert.cc
index b98706a3d0..4ad3123e07 100644
--- a/libs/ardour/plugin_insert.cc
+++ b/libs/ardour/plugin_insert.cc
@@ -240,7 +240,7 @@ PluginInsert::create_automatable_parameters ()
set<Evoral::Parameter> a = _plugins.front()->automatable ();
- Plugin::ParameterDescriptor desc;
+ ParameterDescriptor desc;
for (set<Evoral::Parameter>::iterator i = a.begin(); i != a.end(); ++i) {
if (i->type() == PluginAutomation) {
@@ -1139,7 +1139,7 @@ PluginInsert::set_parameter_state_2X (const XMLNode& node, int version)
float min_y = c->alist()->get_min_y ();
float max_y = c->alist()->get_max_y ();
- Plugin::ParameterDescriptor desc;
+ ParameterDescriptor desc;
_plugins.front()->get_parameter_descriptor (port_id, desc);
if (min_y == FLT_MIN) {
@@ -1194,7 +1194,7 @@ PluginInsert::PluginControl::PluginControl (PluginInsert* p, const Evoral::Param
: AutomationControl (p->session(), param, list, p->describe_parameter(param))
, _plugin (p)
{
- Plugin::ParameterDescriptor desc;
+ ParameterDescriptor desc;
boost::shared_ptr<Plugin> plugin = p->plugin (0);
alist()->reset_default (plugin->default_value (param.id()));