[LV2] [RTID] proposal for a 'real time ID' extension

Hanspeter Portner ventosus at airpost.net
Sat Aug 6 06:07:19 PDT 2016


Hi list

I hereby propose a tiny LV2 extension under working title RTID mainly useful for
event messaging. RTID = Real Time ID.

*Issue*

1. patch:sequenceNumber
When creating/routing patch messages, they can be annotated with a
patch:sequenceNumber to assist in matching of patch queries and their replies.
patch:sequenceNumber should thus be collision-free. If the host is the only
agent issuing patch queries, this poses no problems.

However, in modular hosts, patch queries may be issued by plugins, too. Those
plugins need a way of generating a patch:sequenceNumber that does not collide
with the ones from the host and/or other plugins. Plugins thus need a way to get
such an unambiguous number from the host, e.g. via a feature.

2. Custom modular event systems
LV2 atoms are so versatile that they are predestined to build custom alternative
event systems on top. Let's look at sonification of multi-touch/motion/gesture
event data:

The predominant techique is to annotate new touch/motion/gesture events with
unique integer IDs so they can easily be tracked across space and time [0].
Touch events have a single 'on' event and dozens to thousands of 'update' events
that refresh some or all of the event's dimensions/properties (e.g. like MIDI
aftertouch on steroids).

Let's further imagine pure LV2 event filters that analyse this data to derive
new events (e.g. based on velocity/acceleration or gesture recognition). In
order to discriminate derived events from original ones (they may well be mixed
together downstream in a modular host), they need to be able to request a new
unique ID somehow. Ideally from a central authority, e.g. the host via a feature.

*Cure*

The host provides a feature for plugins (and itself) to request a unique,
collision-free integer ID to annotate arbitrary event messages where needed.

As non-colliding integer IDs are not only useful for patch:sequenceNumber, but
also for custom event systems, it makes sense to not simply add this to the
patch extension, but create a separate one.

*Spec*

The extension is as simple as it can get: A single function which requests the
next integer ID from the host whereby the function MUST be RT-safe,
non-blocking, lock-free and wait-free. New RTIDs may be requested in any of the
many LV2 thread groups.

  typedef void* LV2_RTID_Get_Handle;

  typedef int64_t LV2_RTID;

  typedef struct _LV2_RTID_Get {
    LV2_RTID_Get_Handle handle;
    LV2_RTID (*next)(LV2_RTID_Get_Handle handle);
  } LV2_RTID_Get;

Have a look at the patch [1] and the prerendered documentation [2][3] of the
current proposal.

*Implementation*

This extension can easily be implemented in any host with as little as 1-2
dozens lines of code. The spec itself contains one in C11 with atomics [3].

I have this up and running under another namespace
(http://open-music-kontrollers.ch/lv2/xpress#voiceMap) since months in my humble
experimental host [4] and accompanying plugin bundles [5][6]. It runs smoothly
and has not posed any issues so far.

Feedback is welcome...
Hanspeter

[0] http://www.tuio.org/?tuio20
[1] https://github.com/ventosus/lv2/tree/rtid_ext/lv2/lv2plug.in/ns/ext/rtid
[2] https://paste.open-music-kontrollers.ch/lv2plug.in/ns/ext/rtid/rtid.html
[3] https://paste.open-music-kontrollers.ch/lv2plug.in/doc/html/group__rtid.html
[4] https://github.com/OpenMusicKontrollers/synthpod
[5] https://github.com/OpenMusicKontrollers/espressivo.lv2
[6] https://github.com/OpenMusicKontrollers/moony.lv2


More information about the Devel mailing list