Product description¶
A Product describes a plug-in once, usually as a const:
use ravet_plugin::{Category, Parameter, Product, StateFormat};
const PARAMETERS: &[Parameter] = &[
Parameter::linear("gain_db", "Gain", -60.0, 12.0, 0.0).with_unit("dB"),
Parameter::bypass("bypass", "Bypass"),
];
const PRODUCT: Product = Product::new(
"Example Gain",
"Example Audio",
"1.0.0",
"com.example.gain",
Category::Effect,
StateFormat { tag: *b"EXGAIN01", version: 1 },
)
.with_parameters(PARAMETERS);
Product::resolve validates the description on a control thread. It checks
names, the three-part version, the reverse-domain plug-in ID, layouts (effects
need audio input), at most 1,024 parameters, keys, defaults and a single bypass
toggle. It then resolves parameter IDs and format identities.
Each parameter has a permanent key: an ASCII letter or underscore followed
by up to 63 letters, digits or underscores. Its host ID is either explicit
(with_id), so existing sessions keep loading, or derived from the key by
32-bit FNV-1a with the top bit cleared. IDs never depend on declaration order.
Two parameters whose derived IDs collide are rejected; give one an explicit ID.