Closed riban-bw closed 2 years ago
you set a pset:bank
(http://lv2plug.in/ns/ext/presets#bank) URI in the .ttl.
for example:
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
@prefix pset: <http://lv2plug.in/ns/ext/presets#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix state: <http://lv2plug.in/ns/ext/state#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://code.google.com/p/amsynth/amsynth#PatriksBank05_000_Expressive_Piano_1>
a pset:Preset ;
lv2:appliesTo <http://code.google.com/p/amsynth/amsynth> ;
rdfs:label "PatriksBank05: 000: Expressive Piano 1" ;
pset:bank <http://code.google.com/p/amsynth/amsynth#PatriksBank05> ;
lv2:port [
lv2:symbol "amp_attack" ;
pset:value 0.050000
] .
Indeed, but how is this done with lilv? I have tried to set preset metadata but failed to get this working. Can someone provide example code to set bank?
with https://github.com/lv2/lilv/blob/master/include/lilv/lilv.h#L1626
const LV2_URID atom_urid = map->map(map->handle, LV2_ATOM__URID);
const LV2_URID my_bank = map->map(map->handle, "http:///mybank#foo");
const LV2_URID pset_bank = map->map(map->handle, LV2_PRESETS__bank);
lilv_state_set_metadata(state, pset_bank, &bank, sizeof(bank), atom_urid, LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE).
Brilliant, thanks! I have that working now. Maybe this could be added to some docs or at least some sample code.
The code snippet above assigns a preset to a bank. Whilst here, may I ask how to create a bank?
Slight amendment to @ventosus's code snippet:
#include "lv2/state/state.h"
#include "lv2/urid/urid.h"
#include "lv2/presets/presets.h"
const LV2_URID atom_urid = map->map(map->handle, LV2_ATOM__URID);
const LV2_URID my_bank = map->map(map->handle, "http:///mybank#foo");
const LV2_URID pset_bank = map->map(map->handle, LV2_PRESETS__bank);
lilv_state_set_metadata(state, pset_bank, &my_bank, sizeof(my_bank), atom_urid, LV2_STATE_IS_POD | LV2_STATE_IS_PORTABLE);
const LV2_URID my_bank = map->map(map->handle, "http:///mybank#foo");
Hopefully goes without saying, but please don't actually use a nonsense URI like this.
The code snippet above assigns a preset to a bank. Whilst here, may I ask how to create a bank?
There unfortunately isn't currently any code support for easily creating banks. If you're looking to create a set of presets to publish, people generally do such parts manually (e.g. manually describe the bank/banks in manifest.ttl, generate them from some canonical source of data like in ports, etc).
You can, of course, write whatever data you want and/or manipulate data manually with code, but I'd need to know more about what you're specifically trying to achieve at a higher level to know what the path forward here is.
Hopefully goes without saying, but please don't actually use a nonsense URI like this.
Yep! Of course.
... but I'd need to know more about what you're specifically trying to achieve at a higher level to know what the path forward here is.
I am working on zynthian which uses jalv to host LV2 plugins. I have been working on a patch for jalv to allow saving of presets (which is mostly there - expect a PR soon). When saving the preset it is advantageous to also configure which bank it belongs to, hence this issue. Of course we could (and it sounds like we may have to) manipulate banks manually, directly editing the ttl files but it would be advantageous to be able to manipulate through the lilv library. Given your confirmation that this is not currently implemented, maybe I should raise a separate issue for a feature request.
I have been working on a patch for jalv to allow saving of presets
? Jalv has had preset saving for ~ever
There was no method exposed to the console to save a preset and no method of assigning a preset to a bank.
I see. Sure, the console interface is a toy, and Jalv isn't built for, or terribly appropriate for, this sort of thing, as I keep telling y'all ;) That said, if you want to make it less of a toy, cool.
Considering this closed by https://github.com/lv2/lilv/issues/46#issuecomment-1081176390
Please open a separate issue for creating banks with jalv.
I have been struggling with this for a few days so thought I would ask here. I can save a preset but how do I assign that preset to a bank?