diff options
| author | cashmere <cashmere@autistici.org> | 2026-07-28 20:14:51 +0200 |
|---|---|---|
| committer | cashmere <cashmere@autistici.org> | 2026-07-28 20:14:51 +0200 |
| commit | 32438ce25f69de99d2523b98237f62cfa90890d7 (patch) | |
| tree | 3a712c347dec0889bdea3328b4c817c2d9392b27 /rust/crates/audio/src/lib.rs | |
| parent | f5a82152394fde4d8f740f664ab7737b82861618 (diff) | |
| download | opencut-32438ce25f69de99d2523b98237f62cfa90890d7.tar.gz | |
feat: port domain crates to Rust (session 1 complete)
All green: cargo test --workspace (~300 tests, 0 failures).
- timeline (45): placement, resize/ripple, split, snap, retime,
audio separation, scene helpers
- animation (73): bezier solver, channel sampling, keyframe ops,
split/clamp/clone, param definitions
- commands (9): Command trait, BatchCommand, history, 19 concrete
commands, freeze-frame port 1:1
- audio (22): audible collection, range mixing, mastering limiter,
rms/peak buckets
- text (19): cosmic-text layout/measure/raster, backgrounds,
decorations
- graphics (52): full CSS gradient parser, tiny-skia raster,
4 shape definitions
- effect-defs (16): blur definition, registry, pass resolution
- mask-defs (19): all 9 mask renderers via tiny-skia
- renderer (6): node model + scene builder port
- desktop: GPUI projects screen wired to ProjectStore
- scene: factory (web defaults: v32, Main Track, 1920x1080, 30fps)
Diffstat (limited to 'rust/crates/audio/src/lib.rs')
| -rw-r--r-- | rust/crates/audio/src/lib.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/rust/crates/audio/src/lib.rs b/rust/crates/audio/src/lib.rs new file mode 100644 index 00000000..0bce5647 --- /dev/null +++ b/rust/crates/audio/src/lib.rs @@ -0,0 +1,29 @@ +mod buckets; +mod clips; +mod mix; + +pub use buckets::{ + extract_peak_range, extract_rms_buckets, extract_rms_range, extract_rms_windowed, + sample_bucket_range, +}; +pub use clips::{ + AudibleClip, clamp_db, clamp_retime_rate, collect_audible_elements, db_to_linear, + source_time_at_clip_time, +}; +pub use mix::{apply_mastering, mix_range, render_export_buffer}; + +#[derive(Debug, thiserror::Error)] +pub enum Error { + #[error( + "element {element_id} requires pitch-preserving retime at rate {rate}, which is not supported" + )] + MaintainPitchUnsupported { element_id: String, rate: f64 }, + #[error("invalid time range: end must be after start")] + InvalidTimeRange, + #[error("sample rate must be at least 1")] + InvalidSampleRate, + #[error("channel count must be at least 1")] + InvalidChannelCount, +} + +pub type Result<T> = std::result::Result<T, Error>; |
