[LV2] Possible bug in examploscope_ui.c

David Robillard d at drobilla.net
Wed Feb 8 00:29:58 PST 2017


On 2017-01-24, at 23:01, Samuel Cederlund <essce at yahoo.com> wrote:
> 
> Hi all,
> 
> I'm working on a simple DAW program for Linux. The program constists of a sound synthesis server written in C++ and a gui program in Ocaml. So fare I have incorporated Calf, Guitarix and AMSynth in the program and have started on the x42 plugins. As an exercise, I started incorporating the eg-scope (examploscope). Now I have two questions about examploscope:
> In the port_event function in examploscope_ui.c it says: This is called by the host, typically at a rate of around 25 FPS. 
> Is this something that applies to all gui port_event functions? What should be the arguments to this function in case, for example, the audio synthesis is not running?

This is somewhat misleading, I suppose, since port_event is only called when there is something to deliver for that port.  The idle callback is the only thing that has a regular rate.  Now that I look at it, this example could use a cleanup...

In any case, you really should implement the specification instead of trying to reverse engineer the correct behaviour from plugins.  Nothing in the spec suggests that port_event should be called regularly.  The protocol dictates the behaviour, in this case:

http://lv2plug.in/ns/ext/atom#eventTransfer

> Also, in the port_event function, the atom object is tested for either raw audio or ui state. But the run() function in examploscope.c can forge two atoms after another in the buffer, one containing ui state and the second containing audio data. This would cause the audio data to be lost for the ui. Is this right, or have I missed something? 

Why would the audio data be lost?  As documented above, atom:eventTransfer transfers each individual event in a sequence.  Delivery of events to the UI is not related to the run() cycle, being able to send many events in one cycle is a large part of the reason for using atoms at all.  This is just not possible with control ports because they only store one value.  Typically, hosts must use a ringbuffer to do this, see jalv for an example.

— 
dr



More information about the Devel mailing list