diff options
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/ardour/audio_unit.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/ladspa_plugin.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/lv2_plugin.h | 2 | ||||
-rw-r--r-- | libs/ardour/ardour/parameter_descriptor.h | 74 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin.h | 42 | ||||
-rw-r--r-- | libs/ardour/ardour/variant.h | 1 | ||||
-rw-r--r-- | libs/ardour/ladspa_plugin.cc | 6 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 11 | ||||
-rw-r--r-- | libs/ardour/plugin_insert.cc | 6 | ||||
-rw-r--r-- | libs/surfaces/osc/osc.cc | 4 |
10 files changed, 95 insertions, 55 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())); diff --git a/libs/surfaces/osc/osc.cc b/libs/surfaces/osc/osc.cc index 648dc4ea19..1e53b895b2 100644 --- a/libs/surfaces/osc/osc.cc +++ b/libs/surfaces/osc/osc.cc @@ -1004,7 +1004,7 @@ OSC::route_plugin_parameter (int rid, int piid, int par, float val) return -1; } - Plugin::ParameterDescriptor pd; + ParameterDescriptor pd; pi->plugin()->get_parameter_descriptor (controlid,pd); if (val >= pd.lower && val < pd.upper) { @@ -1051,7 +1051,7 @@ OSC::route_plugin_parameter_print (int rid, int piid, int par) return -1; } - Plugin::ParameterDescriptor pd; + ParameterDescriptor pd; if (pi->plugin()->get_parameter_descriptor (controlid, pd) == 0) { boost::shared_ptr<AutomationControl> c = pi->automation_control (Evoral::Parameter(PluginAutomation, 0, controlid)); |