[LV2] Sending a port event from worker response - ingen problem

David Robillard d at drobilla.net
Mon Jan 21 19:35:32 PST 2013

On Tue, 2013-01-15 at 14:13 +0000, Joe Button wrote:
> Hi there
> I'm having trouble getting my plugin to send a notification from its 
> worker response function to its UI. It seems to work in jalv.gtk and 
> ardour, but not in ingen. This could be ingen's fault, but is more 
> likely to be mine as I'm dabbling in forces I don't really understand.
> The response function is here:
> https://github.com/Joeboy/joeboy-lv2-plugins/blob/dev/fluidsynth/fluidsynth.c#L330
> It writes an atom structure created by the worker to an atom forge which 
> is connected to the UI notification port.
> In jalv.gtk and ardour, the full atom structure is received at the UI's 
> notification port. However ingen seems to get a structure with the 
> preset_list vector missing. ie. this:
> https://github.com/Joeboy/joeboy-lv2-plugins/blob/dev/fluidsynth/fluidsynth_ui.c#L194
> exits with "No preset list found".
> Any hints?

Your preset list atom is corrupt, it kills jalv -d too (perhaps the
forge could check for this...)

Some thread safety issues aside (using plugin->forge and notify buffer
outside the process context), the problem is you are attempting to
construct a vector of non-constant size objects.  You can not do this,
the vector is a compact headerless representation for sending things
like actual vectors of floats, one immediately after the other with no
Atom headers in-between (like an audio buffer).  See the documentation
for http://lv2plug.in/ns/ext/atom#Vector

Specifically, in this line:

lv2_atom_forge_vector_head(&plugin->presetlist_forge, &presetlist_frame,
sizeof(LV2_Atom_Tuple), plugin->forge.Tuple);

You are saying each element of the vector has size
sizeof(LV2_Atom_Tuple), which is way, way off.  You can use Tuple for a
sequence of variable sized objects.  Another option is an object with
Blank values like [ :bank 1 ; :program 1 ; rdfs:label "foo ].  Soon we
will have a vocabulary for that so the host can understand it and you
will not need a custom UI for what you are doing here, for now just use
whatever.  The easy fix to is to do basically the same thing you are
doing except with a Tuple, not a vector.



-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.lv2plug.in/pipermail/devel-lv2plug.in/attachments/20130121/ea46016c/attachment-0002.pgp>

More information about the Devel mailing list