[LV2] Custom value display text for control ports

Hanspeter Portner dev at open-music-kontrollers.ch
Sun Aug 19 14:09:26 PDT 2018


On 8/19/18 10:47 PM, Dominique Würtz wrote:
> Am Sonntag, den 19.08.2018, 16:26 +0200 schrieb Hanspeter Portner:
>> On 8/19/18 10:17 AM, Dominique Würtz wrote:
>>> Is it possible to customize the way a control port value is
>>> represented
>>> as text in the host?
>>> E.g. for a stero pan control with value range -1.0 .. +1.0 I want
>>> it to
>>> be displayed as:
>>>
>>> -100% Left .. -1% Left, <C>, 1% Right .. 100% Right.
>>
>> Yes, LV2 supports arbitrary control ranges and units.
> 
> Thanks, but this is not sufficient here, I'm afraid. In my example, I
> want the value range -1.0 <= x < 0.0 to be displayed as "x% Left" and
> the value range 0.0 < x <= +1.0 as "x% Right". So no simple static
> unit.

Theoretically you could define your own unit and e.g. add your missing zeros
into the units:render [1]:

    unit:render "%1.0f00 %"


But I don't know whether any host uses that property for its generic UIs, most
(and not even all) just make use of units:symbol [2].

So, if you can come up with some magic format specifier string (for printf) that
does  what you want, you could use units:render (and hope that hosts will
implement it some day).

LV2 allows you to use *any* range for control ports (there's no restriction to
-1..+1). If your range is -100..100 (whatever unit), it's easiest to just use
exactly that range, imho.

> For the center value 0.0, I figured I can specify a scalePoint to have
> it displayed as "<C>".

Some hosts interpret control ports with scale points as simple enums, e.g. will
let user choose from specifically defined points only. So this may not have your
desired effect.

[1] http://lv2plug.in/ns/extensions/units#render
[2] http://lv2plug.in/ns/extensions/units#symbol

P.s. There's always the possibility to draw your own UI, there you can do
whatever exotic thing you want ...


More information about the Devel mailing list