[LV2] Patches vs Ports and Multiple IO configurations

David Robillard d at drobilla.net
Tue Apr 20 18:04:47 PDT 2021


On Apr 18, 2021, at 14:30, Binder News <bindernews at gmail.com> wrote:
> 
> Hello there,
> 
> I'm trying to add LV2 support to the iPlug2 framework (https://github.com/iPlug2/iPlug2), and I'm a bit confused as to how to handle parameters and multiple IO setups.
> 
> Parameters:
> The LV2 book talks about using the LV2 patch extension to handle parameters instead of control ports, and I'd like to use this feature, because it supports more fine-grained timings and gives the plugin the ability to force certain parameter values.
> The problem is that when testing with Carla and REAPER neither recognize parameters unless I use the control ports. Since I'm generating everything I can easily support both methods but I'm not sure what the best approach is.
> 
> Multiple IO configurations:
> iPlug2 is designed to allow plugins to support multiple IO configurations (e.g. mono mode or stereo mode). The approach I was going to use was to generate one plugin object for each IO configuration (see "Example 1" below).
> I can then detect which IO configuration the host selected and map channels based on that. Is this the correct approach, or should I just create one configuration with ALL I/O ports and allow the host to pick ports appropriately?
> 
> Thank you,
> ~Binder News
> 
> 
> Example 1:
> <https://iplug2.github.io/plugins/IPlugInstrument#io_0>
>   a lv2:Plugin , lv2:InstrumentPlugin ;
>   ...
> 
> <https://iplug2.github.io/plugins/IPlugInstrument#io_1>
>   a lv2:Plugin , lv2:InstrumentPlugin ;
>   ...

Unfortunately using event-based parameters still suffers from something of a chicken & egg problem, so host support is not very widespread yet.  It's been coming along lately, but not quite at the point where you can generally rely on it being supported (or supported fully/properly/etc).  So there is no right answer here, it depends on your goals/requirements and general tolerance for bleeding edge things.

As for I/O, since LV2 has no facility for dynamic port configuration, using different configurations as in your example is the typical approach for plugins that have stereo/mono/etc variants.  This can be... less than ideal, but is at least very simple.  I'm not sure what "allow the host to pick ports appropriately" means concretely.  We could probably invent something for that easily enough I suppose, but there's no interface in LV2 at present that would allow you to do that dynamically at runtime.

Cheers,

-- 
dr


More information about the Devel mailing list