From 2b7f092b857df8cde0cd4680e9de55f4cb98596b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 14 May 2011 18:43:34 +0000 Subject: Generic scale points API. Hide scale points implementation inside specific Plugin subclass. Don't needlessley/slowly get scale points twice for each port while building UI. Remove dependence on specific plugin types from GenericPluginUI. git-svn-id: svn://localhost/ardour2/branches/3.0@9511 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/ardour/ladspa_plugin.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'libs/ardour/ladspa_plugin.cc') diff --git a/libs/ardour/ladspa_plugin.cc b/libs/ardour/ladspa_plugin.cc index 1ea158d7cd..f5426500a4 100644 --- a/libs/ardour/ladspa_plugin.cc +++ b/libs/ardour/ladspa_plugin.cc @@ -605,6 +605,28 @@ LadspaPlugin::print_parameter (uint32_t param, char *buf, uint32_t len) const } } +boost::shared_ptr +LadspaPlugin::get_scale_points(uint32_t port_index) const +{ + const uint32_t id = atol(unique_id().c_str()); + lrdf_defaults* points = lrdf_get_scale_values(id, port_index); + + boost::shared_ptr ret; + if (!points) { + return ret; + } + + ret = boost::shared_ptr(new ScalePoints()); + + for (uint32_t i = 0; i < points->count; ++i) { + ret->insert(make_pair(points->items[i].label, + points->items[i].value)); + } + + lrdf_free_setting_values(points); + return ret; +} + void LadspaPlugin::run_in_place (pframes_t nframes) { -- cgit v1.2.3