Crate ladspa [−] [src]
The ladspa
crate provides an interface for writing LADSPA
plugins safely in Rust.
Creating the project
Run cargo new my_ladspa_plugin
to generate a Cargo project for your plugin, then add
the following to the generated Cargo.toml:
[dependencies] ladspa = "*" [lib] name = "my_ladspa_plugin" crate-type = ["dylib"]
This will pull in the correct dependency and ensure that the library generated when you build your plugin is compatible with LADSPA hosts.
Writing the code
You'll want to implement
get_ladspa_descriptor
in your src/lib.rs. This function is expected to return 1 or more
PluginDescriptor
s describing the plugins exposed by your library. See the documentation
for get_ladspa_descriptor
and the examples
on Github for more
information.
Testing it out
There is a list of host software supporting LADSPA on the
LADSPA home page. In order for a host to find your plugin, you will
either need to copy the *.so file from target/ after building to /usr/lib/ladspa/ (on most
systems, it may be different on your system) or set the enviornment variable LADSPA_PATH
to equal the directory where you store your plugins.
Structs
ControlHint |
Represents the special properties a control port may hold. These are merely hints as to the
use of the port and may be completely ignored by the host. For audio ports, use |
PluginDescriptor |
Describes the properties of a |
Port |
Represents an input or output to the plugin representing either audio or control data. |
PortConnection |
Represents a connection between a port and the data attached to the port by the plugin host. |
Properties |
Represents the special properties a LADSPA plugin can have.
To attach multiple properties, bitwise-or them together, for example
|
Enums
DefaultValue |
The default values that a control port may hold. For audio ports, use DefaultControlValue::None. |
PortData |
Represents the four types of data a port can hold. |
PortDescriptor |
Represents the 4 types of ports: audio or control, input or output. |
Constants
HINT_INTEGER |
Indicates that the data passed through this port should be represented as integers. Bounds may be interpreted exclusively depending on the host |
HINT_LOGARITHMIC |
Indicates that the data passed through this port would be better represented on a logarithmic scale |
HINT_SAMPLE_RATE |
Indicates that all values related to the port will be multiplied by the sample rate by the host before passing them to your plugin. This includes the lower and upper bounds. If you want an upper bound of 22050 with this property and a sample rate of 44100, set the upper bound to 0.5 |
HINT_TOGGLED |
Indicates that this is a toggled port. Toggled ports may only have default values of zero or one, although the host may send any value, where <= 0 is false and > 0 is true. |
PROP_HARD_REALTIME_CAPABLE |
Indicates that the plugin is capable of running not only in a conventional host but also in a 'hard real-time' environment. To qualify for this the plugin must satisfy all of the following: |
PROP_INPLACE_BROKEN |
Indicates that the plugin will not function correctly if the input and output audio data has the same memory location. This could be an issue if you copy input to output then refer back to previous values of the input as they will be overwritten. It is recommended that you avoid using this flag if possible as it can decrease the speed of the plugin. |
PROP_NONE |
No properties. |
PROP_REALTIME |
Indicates that the plugin has a realtime dependency so it's output may not be cached. |
Traits
Plugin |
Represents an instance of a plugin which may be exposed as a LADSPA plugin using
|
Functions
get_ladspa_descriptor |
Your plugin must implement this function.
|
Type Definitions
Data |
The data type used internally by LADSPA for audio and control ports. |