[LV2] inline plugin displays

Hanspeter Portner ventosus at airpost.net
Wed Mar 16 02:45:15 PDT 2016


On 15.03.2016 03:47, Robin Gareus wrote:
> Hi all,
> 
> Here's another small ad-hoc LV2 extension. I've just prototyped adding
> inline mixer-strip displays. A picture says more than words here:
> 
>   http://robin.linuxaudio.org/tmp/inline_display.png
> 
> small LV2 UIs; display only (non interactive) pixmaps.
> 
> The API consists of two calls:
> 
> 1) A LV2 extension provided by the plugin to render a pixmap.
> 
> This is function is provided by the plugin's shared-object itself (not
> the GUI) because it must also be available when the plugin GUI is not
> visible (not even loaded). It's intended for visualizing the most
> relevant plugin parameters in a tiny area (~100x100px).
> 
> 
> /** raw image pixmap format is ARGB32,
>  * the data pointer is owned by the plugin and must be valid
>  * from the first call to render until cleanup.
>  */
> typedef struct {
>   unsigned char *data;
>   int width;
>   int height;
>   int stride;
> } LV2_Inline_Display_Image_Surface;
> 
> /**
>  * Plugin Inline-Display Interface.
>  */
> typedef struct {
>   /**
>    * The render method. This is called by the host in a non-realtime
>    * context, usually the main GUI thread.
>    * The data pointer is owned by the plugin and must be valid
>    * from the first call to render until cleanup.
>    *
>    * @param instance The LV2 instance
>    * @param w the max available width
>    * @param h the max available height
>    * @return pointer to a LV2_Inline_Display_Image_Surface or NULL
>    */
>   LV2_Inline_Display_Image_Surface* (*render)
>                      (LV2_Handle instance, uint32_t w, uint32_t h);
> } LV2_Inline_Display_Interface;
> 
> 
> 
> 2) A LV2 feature provided by the host. This allows a plugin to tell the
> host that the image needs to be updated. It is intended to be called by
> the plugin in rt-context - during run(), when the ports are valid.
> 
> 
> /** a LV2 Feature provided by the Host to the plugin */
> typedef struct {
> 
>   /** Opaque host data */
>   LV2_Inline_Display_Handle handle;
> 
>   /** Request from run() that the host should call render()
>    * at a later time to update the inline display.
>    */
>   void (*queue_draw)(LV2_Inline_Display_Handle handle);
> } LV2_Inline_Display;
> 
> 
> 
> So far I've implemented this as proof of concept in Ardour, fil4.lv2 and
> meters.lv2 (all git/master).
> 
> thoughts, comments are welcome,
> robin

I like the idea very much (especially the use of a simple ARGB32 surface)
but dare to ask the obvious question:
* Why break with the rigorous separation of DSP vs. UI code & data in LV2
  and not implement this as a new UI class?


More information about the Devel mailing list