35 static const unsigned long blacklist[] = {
41 static bool lib_is_blacklisted(
const std::string& name) {
42 static const char *blacklist[] = {
45 for (
unsigned int i = 0; i <
sizeof(blacklist) /
sizeof(blacklist[0]); i++) {
46 if (name == blacklist[i]) {
53 static const unsigned long quirklist_no_cleanup[] = { 1912, 0 };
54 static const unsigned long quirklist_activate[] = { 1890, 1891, 1893, 1894, 1892, 1903, 1904, 0 };
57 const unsigned long *
ids;
59 {1, quirklist_no_cleanup},
60 {2, quirklist_activate},
64 #define unknown_category "External"
66 static const char *cat_subst[][2] = {
67 {
"Reverbs",
"Reverb"},
68 {
"Filters",
"Tone Control"},
69 {
"EQs",
"Tone Control"},
70 {
"Compressors",
"Guitar Effects"},
71 {
"Utilities",
"Misc"},
72 {
"Delays",
"Echo / Delay"},
73 {
"Phasers",
"Modulation"},
74 {
"Chorus",
"Modulation"},
75 {
"Flangers",
"Modulation"},
76 {
"Modulators",
"Modulation"},
77 {
"Distortions",
"Distortion"},
78 {
"Waveshapers",
"Distortion"},
79 {
"Amplifiers",
"Distortion"},
81 {
"Filter",
"Tone Control"},
82 {
"Distortion",
"Distortion"},
83 {
"Delay",
"Echo / Delay"},
84 {
"Modulator",
"Modulation"},
86 {
"Compressor",
"Guitar Effects"},
94 static inline bool float_eq(
float v1,
float v2) {
95 return std::abs(v1 - v2) <= 1e-5 * std::abs(v1);
99 if (v1.set_flags != v2.set_flags) {
120 if (v1.enumdict.size() != v2.enumdict.size()) {
123 for (std::map<int, ustring>::const_iterator i = v1.enumdict.begin(); i != v1.enumdict.end(); ++i) {
124 std::map<int, ustring>::const_iterator j = v2.enumdict.find(i->first);
125 if (j == v2.enumdict.end() || j->second != i->second) {
134 : name(), dflt(), low(), up(), tp(
tp_scale), enumdict(), newrow(), set_flags(0) {
138 if (jp.
read_kv(
"name", name) ||
143 jp.
read_kv(
"newrow", newrow) ||
144 jp.
read_kv(
"set_flags", set_flags)) {
156 "ladspa::ChangeableValues", Glib::ustring::compose(
"unknown key: %1", jp.
current_value()));
171 jw.
write_kv(
"set_flags", set_flags);
174 for (std::map<int, Glib::ustring>::iterator i = enumdict.begin(); i != enumdict.end(); ++i) {
200 : idx(idx_), pos(pos_), is_output(is_output_), hint_desc(hint.HintDescriptor),
201 fake_low(false), fake_up(false), fake_dflt(false),
203 has_caption(true), factory(), user() {
204 factory.set_name(name);
205 set_range_default(hint, factory);
206 set_default_value(hint, factory);
207 set_tp_default(hint, factory);
211 : idx(), pos(), is_output(), hint_desc(),
212 fake_low(false), fake_up(false), fake_dflt(false),
213 step(
stp_normal), use_sr(false), has_sr(false),
214 has_caption(true), factory(), user() {
235 "ladspa::PortDesc", Glib::ustring::compose(
"unknown key: %1", jp.
current_value()));
283 store.
set_dflt(exp(log(low)*0.75 + log(up)*0.25));
285 store.
set_dflt(exp(log(low)*0.5 + log(up)*0.5));
287 store.
set_dflt(exp(log(low)*0.25 + log(up)*0.75));
294 store.
set_dflt(low * 0.75 + up * 0.25);
296 store.
set_dflt(low * 0.5 + up * 0.5);
298 store.
set_dflt(low * 0.25 + up * 0.75);
371 std::map<int, ustring>::iterator i;
540 return pow(up/low, 1.0/50);
543 return pow(up/low, 1.0/100);
546 return pow(up/low, 1.0/500);
553 s = (up - low) / 30.0;
556 s = (up - low) / 300.0;
559 s = (up - low) / 3000.0;
564 return pow(10.0, round(log10(s)));
572 }
else if (
get_name() ==
"latency") {
627 int iup = int(round(up));
628 for (
int i =
int(round(low)); i < iup+1; ++i) {
637 jp.
next(JsonParser::begin_array);
638 jp.
next(JsonParser::value_number);
640 jp.
next(JsonParser::end_array);
641 jp.
next(JsonParser::value_string);
645 jp.
next(JsonParser::value_number);
647 jp.
next(JsonParser::value_number);
649 jp.
next(JsonParser::value_number);
651 jp.
next(JsonParser::value_number);
653 jp.
next(JsonParser::value_number);
655 jp.
next(JsonParser::value_number);
674 jp.
next(JsonParser::value_number);
679 jp.
next(JsonParser::value_number);
682 jp.
next(JsonParser::begin_array);
684 while (jp.
peek() != JsonParser::end_array) {
685 jp.
next(JsonParser::value_string);
692 jp.
next(JsonParser::end_array);
695 PluginDesc::PluginDesc(
const LADSPA_Descriptor& desc,
int tp_, std::vector<PortDesc*>& ctrl_ports_,
const std::string path_,
int index_)
696 : UniqueID(desc.UniqueID), Label(desc.Label), Name(desc.Name), shortname(desc.Name), Maker(desc.Maker),
697 MasterIdx(-1), MasterLabel(), tp(tp_), ctrl_ports(ctrl_ports_), path(path_), index(index_),
699 ladspa_category(), active(false), active_set(false), has_settings(false), add_wet_dry(0), stereo_to_mono(0), old(0) {
700 quirks = quirks_default = quirks_get();
703 PluginDesc::PluginDesc(LilvWorld *world,
const LilvPlugin* plugin,
int tp_, std::vector<PortDesc*>& ctrl_ports_)
704 : UniqueID(0), Label(), Name(), shortname(), Maker(),
705 MasterIdx(-1), MasterLabel(), tp(tp_), ctrl_ports(ctrl_ports_),
706 path(lilv_node_as_string(lilv_plugin_get_uri(plugin))), index(0),
708 ladspa_category(), active(false), active_set(false), has_settings(false), add_wet_dry(0), stereo_to_mono(0), old(0) {
709 LilvNode* nd = lilv_plugin_get_name(plugin);
710 Glib::ustring s = lilv_node_as_string(nd);
715 nd = lilv_plugin_get_author_name(plugin);
717 nd = lilv_plugin_get_project(plugin);
720 Maker = lilv_node_as_string(nd);
725 path = lilv_node_as_string(lilv_plugin_get_uri(plugin));
726 const LilvPluginClass* cls = lilv_plugin_get_class(plugin);
728 std::vector<Glib::ustring> cats;
729 const LilvPluginClasses* pclasses = lilv_world_get_plugin_classes(world);
731 const LilvNode *pn = lilv_plugin_class_get_parent_uri(cls);
735 const LilvPluginClass* pcls = lilv_plugin_classes_get_by_uri(pclasses, pn);
739 cats.insert(cats.begin(), lilv_node_as_string(lilv_plugin_class_get_label(cls)));
746 PluginDesc::~PluginDesc() {
780 if (jp.
read_kv(
"UniqueID", UniqueID) ||
783 jp.
read_kv(
"shortname", shortname) ||
785 jp.
read_kv(
"MasterIdx", MasterIdx) ||
786 jp.
read_kv(
"MasterLabel", MasterLabel) ||
790 jp.
read_kv(
"category", category) ||
791 jp.
read_kv(
"deduced_category", deduced_category) ||
792 jp.
read_kv(
"quirks", quirks) ||
793 jp.
read_kv(
"quirks_default", quirks_default) ||
795 jp.
read_kv(
"ladspa_category", ladspa_category) ||
796 jp.
read_kv(
"active", active) ||
797 jp.
read_kv(
"active_set", active_set) ||
799 jp.
read_kv(
"add_wet_dry", add_wet_dry) ||
800 jp.
read_kv(
"stereo_to_mono", stereo_to_mono)) {
806 ctrl_ports.push_back(
new PortDesc(jp));
811 "ladspa::PluginDesc", Glib::ustring::compose(
"unknown key: %1", jp.
current_value()));
843 old->serializeJSON(jw);
848 (*i)->serializeJSON(jw);
856 for (
int i = 0; quirk_list[i].flag; i++) {
857 for (
int j = 0; quirk_list[i].ids[j]; j++) {
859 flag |= quirk_list[i].flag;
886 for (std::vector<PortDesc*>::iterator i = p->
ctrl_ports.begin(); i != p->
ctrl_ports.end(); ++i) {
892 void LadspaPluginList::add_plugin(
const LADSPA_Descriptor& desc, pluginmap& d,
const std::string& path,
int index) {
893 for (
unsigned int j = 0; j <
sizeof(blacklist)/
sizeof(blacklist[0]); j++) {
894 if (desc.
UniqueID == blacklist[j]) {
905 std::vector<PortDesc*> ctrl_ports;
907 for (
unsigned int n = 0; n < desc.
PortCount; n++) {
921 if (n_in == 1 && n_out == 1) {
923 }
else if (n_in == 2 && n_out == 2) {
926 for (std::vector<PortDesc*>::iterator i = ctrl_ports.begin(); i != ctrl_ports.end(); ++i) {
935 void LadspaPluginList::load_defs(
const std::string& path, pluginmap& d) {
937 handle = dlopen(path.c_str(), RTLD_LOCAL|RTLD_NOW);
941 ustring::compose(_(
"Cannot open plugin: %1\n"), dlerror()));
945 const char *dlsym_error = dlerror();
958 add_plugin(*desc, d, path, i);
1019 for (
unsigned int i = 0; i <
ctrl_ports.size(); ++i) {
1040 for (
int i = 0; i < static_cast<int>(
ctrl_ports.size()); ++i) {
1084 for (
unsigned int n = 0; n <
ctrl_ports.size(); ++n) {
1085 bool newrow =
false;
1087 newrow = (i % 6 == 0 && i != 0);
1097 for (std::vector<ustring>::const_iterator i = s.begin(); i != s.end(); ++i) {
1103 for (
const char *(*p)[2] = cat_subst; (*p)[0]; ++p) {
1104 if (*i == (*p)[0]) {
1117 if ((*p)->idx == idx) {
1118 (*p)->set_default(value, label);
1136 if (sm == (*p)->get_name()) {
1174 ifstream is(fname.c_str());
1176 gx_print_error(
"ladspalist", ustring::compose(_(
"can't open %1"), fname));
1181 jp.
next(JsonParser::begin_array);
1182 jp.
next(JsonParser::value_number);
1184 jp.
next(JsonParser::value_string);
1189 jp.
next(JsonParser::value_string);
1191 jp.
next(JsonParser::value_number);
1193 jp.
next(JsonParser::value_string);
1195 jp.
next(JsonParser::value_number);
1201 jp.
next(JsonParser::value_number);
1203 if (jp.
peek() == JsonParser::value_number) {
1204 jp.
next(JsonParser::value_number);
1207 std::vector<PortDesc*> ports;
1208 jp.
next(JsonParser::begin_array);
1211 while (jp.
peek() != JsonParser::end_array) {
1212 jp.
next(JsonParser::begin_array);
1213 jp.
next(JsonParser::value_number);
1216 if ((*p)->idx == idx) {
1220 (*p)->set_state(jp, version);
1221 ports.push_back((*p));
1226 jp.
next(JsonParser::end_array);
1228 jp.
next(JsonParser::end_array);
1232 jp.
next(JsonParser::end_array);
1233 jp.
next(JsonParser::end_token);
1238 ustring::compose(_(
"error parsing LADSPA plugin config file %1: %2"), fname, e.
what()));
1258 } ranges_1_based[] = {
1270 world(lilv_world_new()),
1272 lv2_AudioPort(lilv_new_uri(world, LV2_CORE__AudioPort)),
1273 lv2_ControlPort(lilv_new_uri(world, LV2_CORE__ControlPort)),
1274 lv2_InputPort(lilv_new_uri(world, LV2_CORE__InputPort)),
1275 lv2_OutputPort(lilv_new_uri(world, LV2_CORE__OutputPort)),
1276 lv2_connectionOptional(lilv_new_uri(world, LV2_CORE__connectionOptional)) {
1277 LilvNode* false_val = lilv_new_bool(world,
false);
1278 lilv_world_set_option(world,LILV_OPTION_DYN_MANIFEST, false_val);
1279 lilv_world_load_all(world);
1280 lv2_plugins = lilv_world_get_all_plugins(world);
1281 lilv_node_free(false_val);
1284 static bool in_1_based_range(
unsigned long uid) {
1285 for (
unsigned int i = 0; i <
sizeof(ranges_1_based)/
sizeof(ranges_1_based[0]); ++i) {
1286 if (uid >= ranges_1_based[i].
from && uid <= ranges_1_based[i].
to) {
1294 void LadspaPluginList::set_instances(
const char *uri, pluginmap& d, std::vector<ustring>& label,
1295 std::vector<unsigned long>& not_found, std::set<unsigned long>& seen) {
1296 lrdf_uris *uris = lrdf_get_instances(uri);
1298 for (
unsigned int i = 0; i < uris->count; ++i) {
1299 const char *u = uris->items[i];
1300 unsigned long uid = lrdf_get_uid(u);
1301 std::string uid_key = make_key(uid);
1302 if (d.find(uid_key) == d.end()) {
1303 not_found.push_back(uid);
1307 if (seen.find(uid) == seen.end()) {
1309 pd->set_category(label);
1310 for (
unsigned int n = 0; n < pd->ctrl_ports.size(); n++) {
1311 PortDesc *p = pd->ctrl_ports[n];
1312 lrdf_defaults *sval = lrdf_get_scale_values(uid, p->idx);
1314 for (
unsigned int nn = 0; nn < sval[0].count; nn++) {
1315 lrdf_portvalue& t = sval[0].items[nn];
1316 p->factory.set_enumvalue(t.value, t.label);
1318 lrdf_free_setting_values(sval);
1324 uri = lrdf_get_default_uri(uid);
1326 lrdf_defaults *sval = lrdf_get_setting_values(uri);
1328 for (
unsigned int nn = 0; nn < sval[0].count; nn++) {
1329 lrdf_portvalue& t = sval[0].items[nn];
1331 if (in_1_based_range(uid)) {
1334 pd->set_default(idx, t.value, t.label);
1336 lrdf_free_setting_values(sval);
1342 lrdf_free_uris(uris);
1347 void LadspaPluginList::descend(
const char *uri, pluginmap& d,
1348 std::vector<unsigned long>& not_found,
1349 std::set<unsigned long>& seen,
1350 std::vector<ustring>& base) {
1351 lrdf_uris *uris = lrdf_get_subclasses(uri);
1353 for (
unsigned int i = 0; i < uris->count; ++i) {
1354 const char *u = uris->items[i];
1355 base.push_back(lrdf_get_label(u));
1356 set_instances(u, d, base, not_found, seen);
1357 descend(u, d, not_found, seen, base);
1360 lrdf_free_uris(uris);
1364 void LadspaPluginList::get_preset_values(
const char* port_symbol,
1369 LV2Preset*
pdata = (LV2Preset*)user_data;
1371 const LilvPort* port = lilv_plugin_get_port_by_index(
pdata->
plugin, i);
1372 const char* sym = lilv_node_as_string(lilv_port_get_symbol(
pdata->
plugin,port));
1373 if (strcmp(sym, port_symbol) ==0) {
1374 float fvalue = *(
const float*)value;
1388 void LadspaPluginList::set_preset_values(Glib::ustring port_symbol,
1390 Glib::ustring value) {
1392 const LilvPort* port = lilv_plugin_get_port_by_index(
pdata->
plugin, i);
1393 Glib::ustring sym = lilv_node_as_string(lilv_port_get_symbol(
pdata->
plugin,port));
1394 if (sym.compare(port_symbol) ==0) {
1408 void LadspaPluginList::get_presets(LV2Preset *pdata) {
1409 pdata->
cline =
"[\"gx_plugin_version\", 1,\n";
1410 LilvNodes* presets = lilv_plugin_get_related(
pdata->
plugin,
1411 lilv_new_uri(world,LV2_PRESETS__Preset));
1412 LILV_FOREACH(nodes, i, presets) {
1413 const LilvNode* preset = lilv_nodes_get(presets, i);
1414 lilv_world_load_resource(world, preset);
1415 LilvNodes* labels = lilv_world_find_nodes(
1416 world, preset, lilv_new_uri(world, LILV_NS_RDFS
"label"), NULL);
1418 const LilvNode* label = lilv_nodes_get_first(labels);
1420 Glib::ustring set = lilv_node_as_string(label);
1426 std::istringstream stream(stt);
1428 Glib::ustring symbol =
"";
1429 Glib::ustring value =
"";
1430 while (std::getline(stream, st)) {
1431 std::size_t found = st.find(
"lv2:symbol");
1432 if(found !=Glib::ustring::npos) {
1433 std::size_t found1 = st.find(
"\"",found)+1;
1434 std::size_t found2 = st.find(
"\"",found1);
1435 if(found2 !=Glib::ustring::npos) {
1436 symbol = st.substr(found1, (found2-found1));
1441 found = st.find(
"pset:value");
1442 if(found !=Glib::ustring::npos) {
1443 std::size_t found1 = st.find(
" ",found)+1;
1444 if(found1 !=Glib::ustring::npos) {
1445 value = st.substr(found1);
1446 set_preset_values(symbol,
pdata,value);
1453 lilv_state_free(state);
1457 lilv_nodes_free(labels);
1459 lilv_nodes_free(presets);
1462 bool LadspaPluginList::feature_is_supported(
const char* uri)
1464 if (!strcmp(uri,
"http://lv2plug.in/ns/lv2core#isLive")) {
1468 if (!strcmp(uri, (*f)->URI)) {
1478 LilvNodes* requests = lilv_plugin_get_required_features(plugin);
1479 LILV_FOREACH(nodes, f, requests) {
1480 const char* uri = lilv_node_as_uri(lilv_nodes_get(requests, f));
1481 if (!feature_is_supported(uri)) {
1484 lilv_nodes_free(requests);
1488 lilv_nodes_free(requests);
1492 unsigned int ena_port = 0;
1494 std::vector<PortDesc*> ctrl_ports;
1496 unsigned int num_ports = lilv_plugin_get_num_ports(plugin);
1499 const LilvPort* enabled_port = lilv_plugin_get_port_by_designation(plugin, lv2_ControlPort, is_ena);
1501 ena_port = lilv_port_get_index(plugin, enabled_port);
1504 lilv_node_free(is_ena);
1506 for (
unsigned int n = 0; n < num_ports; n++) {
1507 const LilvPort* port = lilv_plugin_get_port_by_index(plugin, n);
1508 if (lilv_port_is_a(plugin, port, lv2_AudioPort)) {
1509 if (lilv_port_is_a(plugin, port, lv2_InputPort)) {
1514 }
else if (lilv_port_is_a(plugin, port, lv2_ControlPort)) {
1518 LilvNode *pdflt, *pmin, *pmax;
1519 lilv_port_get_range(plugin, port, &pdflt, &pmin, &pmax);
1523 lilv_node_free(pmin);
1528 lilv_node_free(pmax);
1530 LilvNode* nm = lilv_port_get_name(plugin, port);
1531 PortDesc *pdesc =
new PortDesc(n, pos, lilv_port_is_a(plugin, port, lv2_OutputPort), lilv_node_as_string(nm), hint);
1534 pdesc->factory.set_dflt(lilv_node_as_float(pdflt));
1535 lilv_node_free(pdflt);
1537 LilvNode* is_int = lilv_new_uri(world, LV2_CORE__integer);
1538 if (lilv_port_has_property(plugin, port, is_int)) {
1539 pdesc->factory.set_tp(
tp_int);
1541 lilv_node_free(is_int);
1542 LilvNode* is_tog = lilv_new_uri(world, LV2_CORE__toggled);
1543 if (lilv_port_has_property(plugin, port, is_tog)) {
1546 lilv_node_free(is_tog);
1547 LilvScalePoints* sp = lilv_port_get_scale_points(plugin, port);
1548 int num_sp = lilv_scale_points_size(sp);
1550 for (LilvIter* it = lilv_scale_points_begin(sp);
1551 !lilv_scale_points_is_end(sp, it);
1552 it = lilv_scale_points_next(sp, it)) {
1553 const LilvScalePoint* p = lilv_scale_points_get(sp, it);
1554 pdesc->factory.set_enumvalue(
1555 lilv_node_as_float(lilv_scale_point_get_value(p)),
1556 lilv_node_as_string(lilv_scale_point_get_label(p)));
1558 pdesc->factory.set_tp(
tp_enum);
1560 lilv_scale_points_free(sp);
1563 if (n == ena_port) {
1568 ctrl_ports.push_back(pdesc);
1571 if (!lilv_port_has_property(plugin, port, lv2_connectionOptional)) {
1578 if (n_in == 1 && n_out == 1) {
1580 }
else if (n_in == 2 && n_out == 2) {
1583 for (std::vector<PortDesc*>::iterator i = ctrl_ports.begin(); i != ctrl_ports.end(); ++i) {
1596 PluginDesc* p = d[lilv_node_as_string(lilv_plugin_get_uri(plugin))] =
new PluginDesc(world, plugin, tp, ctrl_ports);
1599 if (p->path.size() != 0) {
1604 get_presets(&
pdata);
1611 for (LilvIter* it = lilv_plugins_begin(lv2_plugins);
1612 !lilv_plugins_is_end(lv2_plugins, it);
1613 it = lilv_plugins_next(lv2_plugins, it)) {
1614 add_plugin(lilv_plugins_get(lv2_plugins, it), d, options);
1622 ofstream os (pfile.c_str());
1633 return ustring(a->Name) < ustring(b->Name);
1639 pl.
add(
"/usr/lib/ladspa");
1640 pl.
add(
"/usr/local/lib/ladspa");
1641 pl.
add(
"/usr/lib64/ladspa");
1642 pl.
add(
"/usr/local/lib64/ladspa");
1646 Glib::RefPtr<Gio::File> file = *it;
1647 if (!file->query_exists()) {
1650 Glib::RefPtr<Gio::FileEnumerator> child_enumeration =
1651 file->enumerate_children(G_FILE_ATTRIBUTE_STANDARD_NAME
1652 "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
1653 "," G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
1654 Glib::RefPtr<Gio::FileInfo> file_info;
1656 while ((file_info = child_enumeration->next_file())) {
1657 if (file_info->get_attribute_string(G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE) ==
"application/x-sharedlib") {
1658 std::string nm = file_info->get_attribute_byte_string(G_FILE_ATTRIBUTE_STANDARD_NAME);
1659 if (lib_is_blacklisted(nm)) {
1663 load_defs(Glib::build_filename(file->get_path(), nm), d);
1669 rpl.add(
"/usr/share/ladspa/rdf");
1670 rpl.add(
"/usr/local/share/ladspa/rdf");
1674 Glib::RefPtr<Gio::File> file = *it;
1675 if (!file->query_exists()) {
1678 Glib::RefPtr<Gio::FileEnumerator> child_enumeration =
1679 file->enumerate_children(G_FILE_ATTRIBUTE_STANDARD_NAME
1680 "," G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME
1681 "," G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE);
1682 Glib::RefPtr<Gio::FileInfo> file_info;
1684 while ((file_info = child_enumeration->next_file())) {
1686 if (file_info->get_attribute_string(G_FILE_ATTRIBUTE_STANDARD_FAST_CONTENT_TYPE) ==
"application/rdf+xml") {
1687 std::string nm = file_info->get_attribute_byte_string(G_FILE_ATTRIBUTE_STANDARD_NAME);
1688 if (lib_is_blacklisted(nm)) {
1691 lrdf_read_file((
"file://"+Glib::build_filename(file->get_path(), nm)).c_str());
1695 std::vector<unsigned long> not_found;
1696 std::set<unsigned long> seen;
1697 std::vector<ustring> base;
1698 locale_t loc = newlocale(LC_ALL,
"C", 0);
1700 descend(LADSPA_BASE
"Plugin", d, not_found, seen, base);
1701 uselocale(LC_GLOBAL_LOCALE);
1705 lv2_load(d, options);
1711 jp.
next(JsonParser::begin_array);
1712 while (jp.
peek() == JsonParser::begin_array) {
1713 jp.
next(JsonParser::begin_array);
1714 jp.
next(JsonParser::value_string);
1716 jp.
next(JsonParser::value_number);
1718 jp.
next(JsonParser::value_number);
1721 key = make_key(uid);
1723 if (d.find(key) == d.end()) {
1724 old_not_found.push_back(key);
1726 d[key]->set_active(
true);
1727 d[key]->active_set =
true;
1729 jp.
next(JsonParser::value_string);
1730 jp.
next(JsonParser::end_array);
1735 "ladspalist", ustring::compose(
1736 _(
"error loading ladspa plugin selection data from file %1"),
1741 for (pluginmap::iterator v = d.begin(); v != d.end(); ++v) {
1744 if (v->second->is_lv2) {
1750 if (access(fname.c_str(), F_OK) != 0) {
1752 if (access(fname.c_str(), F_OK) != 0) {
1756 if (!fname.empty()) {
1757 v->second->set_state(fname);
1760 for (pluginmap::iterator i = d.begin(); i != d.end(); ++i) {
1761 push_back(i->second);
1763 std::sort(begin(),
end(), cmp_plugins);
1768 std::string tfname = fname +
".tmp";
1769 ofstream tfile(tfname.c_str());
1771 jw.begin_array(
true);
1772 for (std::vector<PluginDesc*>::iterator p = begin(); p !=
end(); ++p) {
1774 (*p)->output_entry(jw);
1780 std::vector<std::pair<std::string,std::string> > fl;
1781 for (std::vector<PluginDesc*>::iterator p = begin(); p !=
end(); ++p) {
1782 std::string sname = ((*p)->is_lv2 ?
1786 if ((*p)->active || (*p)->has_settings) {
1787 std::string tcname = cname +
".tmp";
1788 ofstream tcfile(tcname.c_str());
1793 fl.push_back(std::pair<std::string,std::string>(tcname, cname));
1795 fl.push_back(std::pair<std::string,std::string>(
"", cname));
1798 if (rename(tfname.c_str(), fname.c_str()) != 0) {
1800 strerror_r(errno, buf,
sizeof(buf));
1802 "ladspalist",ustring::compose(_(
"error renaming LADSPA config file '%1': %2"), fname, buf));
1805 for (std::vector<std::pair<std::string,std::string> >::iterator i = fl.begin(); i != fl.end(); ++i) {
1806 if (i->first.empty()) {
1807 unlink(i->second.c_str());
1809 if (rename(i->first.c_str(), i->second.c_str()) != 0) {
1811 strerror_r(errno, buf,
sizeof(buf));
1814 ustring::compose(
"error renaming %1 to %2: %3\n", i->first, i->second, buf));
1831 for (iterator i = begin(); i !=
end(); ++i) {
1832 (*i)->serializeJSON(jw);
1838 for (iterator i = begin(); i !=
end(); ++i) {
1841 lilv_node_free(lv2_AudioPort);
1842 lilv_node_free(lv2_ControlPort);
1843 lilv_node_free(lv2_InputPort);
1844 lilv_node_free(lv2_OutputPort);
1845 lilv_node_free(lv2_connectionOptional);
1846 lilv_world_free(world);