[LV2] Thoughts on a clearer atom forge API

Kaspar Emanuel kaspar.emanuel at gmail.com
Sun Jan 12 18:49:10 PST 2014


On 12 January 2014 23:25, David Robillard <d at drobilla.net> wrote:
> []
>     a my:Message ;
>     rdfs:label "A wild message appears!" ;
>     my:intensity 9000 .
>
> this would get you something like:
>
> frame = forge.object(uris.my_Message);
> frame.key(uris.rdfs_label);
> frame.string("A wild message appears!");
> frame.key(uris.my_intensity)
> frame.value(9000)
> frame.end();
>

This looks quite nice (or am I just getting used to the terminology?).
Would you really need the end() ? Then end is implied when you send
no?

I suppose you are proposing this as C++ only. What could be done to
make the C API more beginner friendly?

> That's my best proposal so far.  Do better.

Pie in the sky I can do! Viable is another thing. As I have a very
limited understanding of the LV2 internals, take this with a grain of
salt.

Following on from the Protobuf discussions we had in the other thread:
my ideal at the moment would be if I could define my message in ttl
with something like:

<my:Message>
    a patch:Message ;
    rdf:property [
        a xsd:String;
        lv2:name "label"
        xsd:maxLength 256
    ] , [
        a xsd:Integer;
        lv2:name "intensity"
        lv2:maximum 9001
        lv2:minum 0
    ] ;

(not sure about a lot of the URIs here, rdfs has range properties as well)

Which then generates a header to include and use like so:

#include "MyMessage.h"
MyMessage* msg = MyMessage_get();
msg->label = "A wild message appears!";
msg->intensity = 9000;
lv2_port_write(0, msg);

and on the other end:

#include "MyMessage.h"
LV2_ATOM_SEQUENCE_FOREACH(0, ev) {
    MyMessage* msg = MyMessage_decode(ev)
    if ((msg->intensity) > 9000)
        exclaim("It's Over 9000!!!");
}

As I said before, I don't have a very good understanding of LV2
internals and host implementations so I can't say where the memory
allocation could happen exactly. The limits are well-defined at least.

Totally pie in the sky. Probably loads of work.



More information about the Devel mailing list