1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
//! Audio plugins: a plugin takes a [`weirdnet_media::waveform::Waveform`] and typed parameters and returns a new waveform or an error.
//!
//! * [`Plugin`] and [`ParamSpec`]: what a plugin is and which parameters it takes (kind, range, default, unit).
//! * [`ParamValues`]: the values for one use of a plugin. [`ParamSpec`]s validate and resolve them (defaults filled in, unknown names and
//! out-of-range values rejected), so a plugin only ever sees complete, valid values.
//! * [`Registry`]: plugins by id. [`Registry::with_builtins`] has `weirdnet.gain`, `weirdnet.levels`, `weirdnet.frequencies` and `weirdnet.duration`.
//! * [`apply_chain`]: runs [`PluginInstance`]s in order; the error says which step failed. [`chain_cache_key`] is the BLAKE3 key a cache
//! uses for the result: source content, plugin ids and versions, resolved parameter values; bypassed steps do not count.
//!
//! ```
//! use weirdnet_audio_plugin::{ParamValues, PluginInstance, Registry, apply_chain, chain_cache_key, waveform_hash};
//! use weirdnet_media::waveform::Waveform;
//!
//! let registry = Registry::with_builtins();
//! let input = Waveform::tone(48_000, 440.0, 4_800, 0.5)?;
//! let chain = [
//! PluginInstance::new("weirdnet.frequencies", ParamValues::new().with_choice("type", "low").with_float("cutoff_hz", 800.0)),
//! PluginInstance::new("weirdnet.gain", ParamValues::new().with_float("gain_db", -6.0)),
//! ];
//! let output = apply_chain(®istry, &input, &chain)?;
//! let cache_key = chain_cache_key(®istry, &waveform_hash(&input), &chain)?;
//! assert_eq!(output.frames(), input.frames());
//! assert_eq!(cache_key.len(), 32);
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! Every built-in's defaults are an identity, so a freshly added plugin changes nothing until a parameter moves. Hosting third-party plugin formats is out of scope.
pub use ;
pub use PluginError;
pub use ;
pub use ;