-vector<string>
-GenericPluginUI::setup_scale_values(guint32 port_index, ControlUI* cui)
-{
- vector<string> enums;
- boost::shared_ptr<LadspaPlugin> lp;
-#ifdef HAVE_SLV2
- boost::shared_ptr<LV2Plugin> lv2p;
-#endif
-
- if ((lp = boost::dynamic_pointer_cast<LadspaPlugin>(plugin)) != 0) {
- // all LADPSA plugins have a numeric unique ID
- uint32_t id = atol (lp->unique_id().c_str());
-
- cui->combo_map = new std::map<string, float>;
- lrdf_defaults* defaults = lrdf_get_scale_values(id, port_index);
- if (defaults) {
- for (uint32_t i = 0; i < defaults->count; ++i) {
- enums.push_back(defaults->items[i].label);
- pair<string, float> newpair;
- newpair.first = defaults->items[i].label;
- newpair.second = defaults->items[i].value;
- cui->combo_map->insert(newpair);
- }
-
- lrdf_free_setting_values(defaults);
- }
-
-#ifdef HAVE_SLV2
- } else if ((lv2p = boost::dynamic_pointer_cast<LV2Plugin>(plugin)) != 0) {
-
- SLV2Port port = lv2p->slv2_port(port_index);
- SLV2ScalePoints points = slv2_port_get_scale_points(lv2p->slv2_plugin(), port);
- cui->combo_map = new std::map<string, float>;
-
- for (unsigned i=0; i < slv2_scale_points_size(points); ++i) {
- SLV2ScalePoint p = slv2_scale_points_get_at(points, i);
- SLV2Value label = slv2_scale_point_get_label(p);
- SLV2Value value = slv2_scale_point_get_value(p);
- if (label && (slv2_value_is_float(value) || slv2_value_is_int(value))) {
- enums.push_back(slv2_value_as_string(label));
- pair<string, float> newpair;
- newpair.first = slv2_value_as_string(label);
- newpair.second = slv2_value_as_float(value);
- cui->combo_map->insert(newpair);
- }
- }
-
- slv2_scale_points_free(points);
-#endif
- }
-
-
- return enums;
-}
-
-