diff options
author | Carl Hetherington <carl@carlh.net> | 2012-03-21 16:43:01 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2012-03-21 16:43:01 +0000 |
commit | 21a0b7ace085ec506950d357ca8958c19dd1060c (patch) | |
tree | c9b5dcb2ad90817f3389fe8b25df8e6400129394 | |
parent | 0af622521ba3cc35cd82f8da10d4c32830ee1305 (diff) |
Use combo box for plugin controls for ports marked as
lv2:enumeration.
git-svn-id: svn://localhost/ardour2/branches/3.0@11745 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/generic_pluginui.cc | 8 | ||||
-rw-r--r-- | libs/ardour/ardour/plugin.h | 6 | ||||
-rw-r--r-- | libs/ardour/lv2_plugin.cc | 4 |
3 files changed, 16 insertions, 2 deletions
diff --git a/gtk2_ardour/generic_pluginui.cc b/gtk2_ardour/generic_pluginui.cc index 833c4a7f91..af294e89c2 100644 --- a/gtk2_ardour/generic_pluginui.cc +++ b/gtk2_ardour/generic_pluginui.cc @@ -518,8 +518,12 @@ GenericPluginUI::build_control_ui (guint32 port_index, boost::shared_ptr<Automat */ int const steps = desc.integer_step ? (desc.upper - desc.lower + 1) / desc.step : 0; - if (control_ui->scale_points && steps && control_ui->scale_points->size() == steps) { - /* There is a label for each possible value of this input, so build a combo box */ + if (control_ui->scale_points && ((steps && control_ui->scale_points->size() == steps) || desc.enumeration)) { + + /* Either: + * a) There is a label for each possible value of this input, or + * b) This port is marked as being an enumeration. + */ std::vector<std::string> labels; for ( diff --git a/libs/ardour/ardour/plugin.h b/libs/ardour/ardour/plugin.h index ec185b3a31..d73fef2f53 100644 --- a/libs/ardour/ardour/plugin.h +++ b/libs/ardour/ardour/plugin.h @@ -84,6 +84,11 @@ class Plugin : public PBD::StatefulDestructible, public Latent struct ParameterDescriptor { + /* XXX: it would probably be nice if this initialised everything */ + ParameterDescriptor () + : enumeration (false) + {} + /* essentially a union of LADSPA and VST info */ bool integer_step; @@ -98,6 +103,7 @@ class Plugin : public PBD::StatefulDestructible, public Latent float largestep; bool min_unbound; bool max_unbound; + bool enumeration; }; XMLNode& get_state (); diff --git a/libs/ardour/lv2_plugin.cc b/libs/ardour/lv2_plugin.cc index 4d63a751cd..a12241b776 100644 --- a/libs/ardour/lv2_plugin.cc +++ b/libs/ardour/lv2_plugin.cc @@ -105,6 +105,7 @@ public: LilvNode* lv2_integer; LilvNode* lv2_sampleRate; LilvNode* lv2_toggled; + LilvNode* lv2_enumeration; LilvNode* midi_MidiEvent; LilvNode* ui_GtkUI; LilvNode* ui_external; @@ -985,6 +986,8 @@ LV2Plugin::get_parameter_descriptor(uint32_t which, ParameterDescriptor& desc) c desc.largestep = delta / 10.0f; } + desc.enumeration = lilv_port_has_property(_impl->plugin, port, _world.lv2_enumeration); + lilv_node_free(def); lilv_node_free(min); lilv_node_free(max); @@ -1336,6 +1339,7 @@ LV2World::LV2World() lv2_integer = lilv_new_uri(world, LILV_NS_LV2 "integer"); lv2_sampleRate = lilv_new_uri(world, LILV_NS_LV2 "sampleRate"); lv2_toggled = lilv_new_uri(world, LILV_NS_LV2 "toggled"); + lv2_enumeration = lilv_new_uri(world, LILV_NS_LV2 "enumeration"); midi_MidiEvent = lilv_new_uri(world, LILV_URI_MIDI_EVENT); ui_GtkUI = lilv_new_uri(world, NS_UI "GtkUI"); ui_external = lilv_new_uri(world, NS_UI "external"); |