[LV2] jalv hacking

Hermann Meyer brummer- at web.de
Sat Aug 29 08:30:21 PDT 2015


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.
I've send a request to http://dev.drobilla.net/ 13 day's ago, ( 
http://dev.drobilla.net/ticket/1076 ) with patch included, I've tried to 
contact david on IRC and ask him if there is a chance for the patch to 
be accepted.
No response and no answer up to now.
I've read the interview on  libremusicproduction.com
http://libremusicproduction.com/articles/lmp-asks-11-interview-david-robillard-aka-drobilla
were he stated on the question:
*What changes, if any, would you like to see within the Linux Audio 
community?*

> Lack of useful feedback is a big problem for developers.


So what, I've never seen such a leak of response on feedback given on a 
tracker then on  dev.drobilla.net

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.
So what, lets save a state file form the preset to load, and I try:

>     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);
>                 const char* set =  lilv_node_as_string(label);
>                 if (strcmp 
> (set,row.get_value(psets.col_label).c_str()) == 0) {
>                     state = lilv_state_new_from_world(world, &map, 
> preset);
>  lilv_state_save(world,&map,&unmap,state,NULL,"tmp/","state.ttl");
>                 }
>                 lilv_nodes_free(labels);
>             }
>    }

and fail. I tried the very same inside of jalv, hacking the required 
functions in, but, no avail.
The saved state file remains empty, and jalv segfault, while it isn't a 
problem to load the same state  on startup when I didn't try to save it 
to file but just load it from the pointer (see my requested feature on 
dev.drobilla.net)

Now this is the point, were I need help, How the heck could I save a 
statefile from a LilvState* state pionter which otherwise work well, but 
is loaded with lilv_state_new_from_world() while the plugin itself isn't 
loaded.

All test-cases I found works only with lilv_state_new_from_file() or 
with lilv_state_new_from_instance()

Thanks for reading
hermann


More information about the Devel mailing list