On 2/1/21 4:32 PM, Jaroslav Kysela wrote:
Dne 01. 02. 21 v 16:03 Camel Guo napsal(a):
From: Camel Guo camelg@axis.com
In order for external software components to adjust ladspa plugin dynamically, this commit adds an option to exposes the control array of input control ports of a ladspa plugin to a file, through which any applications with proper permission can control this plugin.
It looks like a pure hack (although the implementation is interesting). The controls may be exposed via the ctl (control) API like we do in src/pcm/pcm_softvol.c for example. The floats can be mapped to integer64 or we may discuss to add the float type to the control API elements.
If there are not so many input controls of a ladspa plugin, I think it is okay to implement it like pcm_softvol.c. But the problem is that some plugins might have more than 100 input controls. For every input control, there will be a system call ioctl in order to get its value. This will make performance really bad. If a ladspa plugin like this needs to support per-channel control, that will make it even worst.
But with shared memory like this, it will become a pure memory read, this will make performance acceptable.
Another benefit of exposing ladspa control array to shared memory is that it makes it possible for any algorithms to connect with these ladspa plugins. The ladspa control array is basically a float-array, which is exactly the input, output of lots of machine learning, deep learning algorithm. Imagine an algorithm listening to the audio stream automatically applies privacy masks on audio stream to mask human voice via ladspa plugins.
Jaroslav
-- Jaroslav Kysela perex@perex.cz Linux Sound Maintainer; ALSA Project; Red Hat, Inc.