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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Dependency-free utilities shared across the truce workspace.
//!
//! - [`cast`] — numeric-cast helpers for the audio-plugin → host FFI
//! boundary (`usize` ↔ `u32` length casts, host `f64` ↔ DSP `f32`,
//! discrete-index ↔ normalized).
//! - [`midi`] — MIDI value-domain normalize / denormalize between
//! wire-native integers and `f32` ranges, plus the spec's MIDI 1.0
//! ↔ MIDI 2.0 bit-replication bridges.
//! - [`shell_sidecar`] — sidecar-file path resolution shared by
//! `cargo-truce` (writes the sidecar at install-time) and the
//! `truce::plugin!` macro (reads it at runtime to locate the logic
//! dylib for hot-reload).
//! - [`slugify`] — ASCII-safe filesystem / IRI slug used by the LV2
//! staging path and runtime bundle-name derivation.
//!
//! `truce-core` re-exports the modules above so consumers that pull
//! `truce-core` don't need a second dependency. Crates that want to
//! avoid `truce-core`'s `truce-params` chain (notably `cargo-truce`)
//! depend on `truce-utils` directly.
/// Slug a plugin's display name into a lowercase, hyphenated,
/// ASCII-safe identifier suitable for filesystem paths, LV2 bundle
/// names, and IRI components.
///
/// Rules: ASCII alphanumerics pass through lowercased; every other
/// character (including runs of them) collapses to a single `-`;
/// leading and trailing dashes are trimmed.