[LV2] jalv hacking

David Robillard d at drobilla.net
Sat Aug 29 14:28:24 PDT 2015


On Sat, 2015-08-29 at 17:30 +0200, Hermann Meyer wrote:
> Hi
> 
> In my previous post I announced jalv.select, to be a little GUI to 
> select a plugin from a list and select the jalv interpreter to use.
> Now, I've extended this GUI to select a preset to load on start-up with 
> jalv. Unfortunately this requires a patch to jalv so that jalv could 
> load a preset from URI or from preset::label.

A label is not an identifier.  An individual preset may have many (e.g.
translations), several presets may have the same label, and they may
change over time for the "same" preset.

Loading via label might be a convenient feature for users to use
directly, but any tool should definitely use the URI to identify the
preset to be loaded.

> However, enough of hitting on the pipe, I'm accept that, and started to 
> try to use the state load interface which jalv comes with.
> Two problems occur, when working with presets.
> I could create a preset menu with
> 
> > void PresetList::create_preset_list(Glib::ustring id, const 
> > LilvPlugin* plug, LilvWorld* world) {
> >     LilvNodes* presets = lilv_plugin_get_related(plug,
> >       lilv_new_uri(world,LV2_PRESETS__Preset));
> >     presetStore->clear();
> >     LILV_FOREACH(nodes, i, presets) {
> >         const LilvNode* preset = lilv_nodes_get(presets, i);
> >         lilv_world_load_resource(world, preset);
> >         LilvNodes* labels = lilv_world_find_nodes(
> >           world, preset, lilv_new_uri(world, LILV_NS_RDFS "label"), NULL);
> >         if (labels) {
> >             const LilvNode* label = lilv_nodes_get_first(labels);
> >             Glib::ustring set =  lilv_node_as_string(label);
> >             row = *(presetStore->append());
> >             row[psets.col_label]=set;
> >             row[psets.col_uri] = lilv_node_as_uri(preset);
> >             lilv_nodes_free(labels);
> >         } else {
> >             fprintf(stderr, "Preset <%s> has no rdfs:label\n",
> >                     lilv_node_as_string(lilv_nodes_get(presets, i)));
> >         }
> >     }
> >     lilv_nodes_free(presets);
> >     create_preset_menu(id);
> > }
> and get access to the preset label and uri. Non of that get accepted by 
> jalv. Jalv only accept state file/path to load. to bad, I didn't know 
> the path of the preset files, and, on top of it preset files contain a 
> couple of presets. So no avail.

I do not understand the problem here.  You clearly need to, and did
attempt to, add a feature to Jalv for this.  Trying to kludge around it
because I didn't immediately accept your patch within 13 days is
ridiculous.

Add a command line option to Jalv to load a preset on startup by URI,
and have your tool use that to specify the appropriate preset.  All the
code necessary to load a preset by URI is already present in Jalv
(jalv_apply_preset).

-- 
dr





More information about the Devel mailing list