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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
//! # audio-automation
//!
//! Generic automation system for audio parameters - framework-agnostic.
//!
//! This crate provides:
//! - **Automation curves** - 20+ curve types including linear, exponential, bezier, and advanced easing
//! - **Automation envelopes** - Time-based parameter control with multiple points
//! - **Automation states** - DAW-style states (Off/Play/Write/Touch/Latch)
//! - **Generic target system** - Works with any parameter type via generics
//! - **Serialization support** - Save/load automation with serde
//! - **`#![no_std]`** - Works on embedded and WASM targets (requires `alloc`)
//!
//! ## Quick Start
//!
//! ```rust
//! use audio_automation::{AutomationEnvelope, AutomationPoint, CurveType};
//!
//! #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
//! enum Param { Volume, Cutoff }
//!
//! let env = AutomationEnvelope::new(Param::Volume)
//! .with_point(AutomationPoint::new(0.0, 0.0))
//! .with_point(AutomationPoint::with_curve(4.0, 1.0, CurveType::Exponential))
//! .with_range(0.0, 1.0);
//!
//! let value = env.get_value_at(2.0).unwrap();
//! ```
//!
//! ## Curve Types
//!
//! - **Linear** - Straight line interpolation
//! - **Exponential** - Accelerating (ease-in)
//! - **Logarithmic** - Decelerating (ease-out)
//! - **SCurve** - S-shaped (ease in-out)
//! - **Stepped** - No interpolation (staircase)
//! - **Bezier** - Custom curve with control points
//! - **Advanced Easing** - Elastic, Bounce, Back, Circular, and polynomial variants
//!
//! ## Example: Transformations
//!
//! ```rust
//! use audio_automation::*;
//!
//! # #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
//! # enum Param { Volume }
//!
//! let mut automation = AutomationEnvelope::new(Param::Volume)
//! .with_point(AutomationPoint::new(0.0, 0.0))
//! .with_point(AutomationPoint::with_curve(4.0, 1.0, CurveType::SCurve))
//! .with_point(AutomationPoint::new(8.0, 0.5));
//!
//! automation
//! .shift_points(2.0)
//! .scale_time(1.5)
//! .clamp_values(0.0, 1.0);
//!
//! assert!(automation.get_value_at(3.0).unwrap() < 0.1);
//! ```
//!
//! ## Example: Iterating and Indexing
//!
//! ```rust
//! use audio_automation::*;
//!
//! # #[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
//! # enum Param { Volume, Cutoff }
//!
//! let env = AutomationEnvelope::new(Param::Volume)
//! .with_point(AutomationPoint::new(0.0, 0.0))
//! .with_point(AutomationPoint::new(2.0, 0.5))
//! .with_point(AutomationPoint::new(4.0, 1.0));
//!
//! // Index into points
//! assert_eq!(env[0].time, 0.0);
//!
//! // Iterate over points
//! let times: Vec<f64> = (&env).into_iter().map(|p| p.time).collect();
//! assert_eq!(times, vec![0.0, 2.0, 4.0]);
//!
//! // Iterate over a clip's envelopes
//! let clip = AutomationClip::new("Intro", 4.0)
//! .with_envelope("volume", AutomationEnvelope::new(Param::Volume)
//! .with_point(AutomationPoint::new(0.0, 0.0))
//! .with_point(AutomationPoint::new(4.0, 1.0)))
//! .with_envelope("cutoff", AutomationEnvelope::new(Param::Cutoff)
//! .with_point(AutomationPoint::new(0.0, 0.5))
//! .with_point(AutomationPoint::new(4.0, 1.0)));
//!
//! for (key, envelope) in &clip {
//! let _ = envelope.get_value_at(2.0);
//! let _ = key;
//! }
//! // Index by key
//! assert!(clip["volume"].get_value_at(2.0).unwrap() > 0.0);
//! ```
extern crate alloc;
extern crate std;
pub use AutomationClip;
pub use CurveType;
pub use ;
pub use ;
pub use AutomationState;