Trying to do a LV2 plugin with lv2-rust but lv2:inPlaceBroken is not supported by Ardour

Hi, I’m trying to create a LV2 plugin to use in Ardour, coding in Rust with the lv2-rust library.

The plugin must be lv2:inPlaceBroken, because Rust cannot have two pointers to the same address (by design).

Ardour just rejects it because it doesn’t support lv2:inPlaceBroken.

Is there any plan to include support for this? Probably just means that for this specific case Ardour needs to allocate two independent buffers instead of one. Yes it is slower, but if it’s only for these plugins it would be fine.

Also, I don’t have full understanding on what lv2:inPlaceBroken does, or more specifically, what happens if this feature is not requested; which pointers are shared and how. Maybe I can just “lie” about this and take this onto account while coding.

No, there are no plans. Although it would not be too hard to implement this. However other hosts e.g. JACK hosts have will have the same issue (jack ports for a serial connection are also zero-copy).

When the host calls connect_port a pointer to the same memory area is returned for both input and output. In the plugin those pointers can be assigned to different variables.

So you can probably fake it in Rust, and carefully write the DSP in a way that does not access any input data that was already written to.

A common way to handle this in some C plugins is

if (input_port != output_port) {
   copy input to output;
}
process (output_port);

Another approach is to first copy the input signal inside the plugin to a (pre-allocated) buffer.


PS. Note that buffers may or may not be in-place. e.g. A mono to stereo plugin may have different buffers for input and output of the first channel.

PS. Apparently this is already solved in lv2-rust:

For now I’m using Carla to test it, and I can run it in Ardour this way.

It’s nice they have fixed the problem in rust-lv2, but that code hasn’t been released yet. I hope they do in the next months. I bet the update will break my codebase, but that’s okay.

The problem of reusing the memory is that it is a bit finicky. I might give it a try at some point if rust-lv2 does not publish a new version on time. Hope I don’t blow my ears… again.

Thanks for your answer, it’s very insightful.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.