[LV2] How to handle sample rate changes?

David Robillard d at drobilla.net
Tue Oct 4 15:16:07 PDT 2016

On Mon, 2016-10-03 at 22:47 +0200, Stefan Westerfeld wrote:
>    Hi!
> I'm considering adding LV2 Instrument support to BEAST. Unlike qtractor or
> Ardour, BEAST doesn't have a concept of project|session sample rate.  It is
> renegotiated every time the user presses play, and thus subject to change. Now
> the standard LV2 API doesn't allow me to change the sample rate at runtime, as
> it is set during initialization.
> After some research I found the LV2 Options Interface, and the possibilty to
> dynamically supply the plugin with a new sample rate. So is this the way to do
> it?
> I suspect that many plugins will assume that the sample rate is constant,
> because the standard LV2 API suggests it. Should we in this case file feature
> requests?

For all the reasons mentioned by others in the thread, I think you're
probably better off simply reinstantiating the plugin.

There doesn't seem to be much win in dealing with the burden of a
dynamic sampling rate (if the plugin doesn't care much, reinstantiation
will be cheap, and if it does, the overhead of changing will be there
regardless), though I'm open to arguments otherwise...

The main "win" I can think of is that it doesn't nuke plugin state, but
a host is going to need the ability to restore plugin state reliably
anyway (for copy/paste, save/restore, and so on) so that doesn't seem
like much of a win after all, particularly when viewed in light of the
general LV2 design directive "complexity should be kept out of plugins
unless absolutely necessary"


More information about the Devel mailing list