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
//! `resonant-stream` — streaming DSP pipeline.
//!
//! This crate provides a pull-based, synchronous processing pipeline for audio
//! DSP. Chunks of sample data flow through a chain of [`DspNode`]s, each
//! transforming the audio in place where possible to minimise allocations.
//!
//! # Architecture
//!
//! ```text
//! ┌───────────┐ ┌───────────┐ ┌───────────┐
//! │ Source │───▶│ Node A │───▶│ Node B │───▶ output
//! │ (Chunk) │ │ (filter) │ │ (gain) │
//! └───────────┘ └───────────┘ └───────────┘
//! ```
//!
//! - [`Chunk`] carries interleaved samples plus metadata (sample rate, channels).
//! - [`DspNode`] is the core trait — implement it to create custom processors.
//! - [`StreamError`] covers format mismatches and processing failures.
//!
//! # Quick start
//!
//! ```
//! use resonant_stream::{Chunk, DspNode, StreamError};
//!
//! // A simple gain node that scales all samples.
//! struct Gain(f32);
//!
//! impl DspNode for Gain {
//! fn process(&mut self, mut input: Chunk) -> Result<Chunk, StreamError> {
//! for s in input.data_mut() {
//! *s *= self.0;
//! }
//! Ok(input)
//! }
//! fn reset(&mut self) {}
//! }
//!
//! let mut gain = Gain(0.5);
//! let chunk = Chunk::new(vec![1.0, -1.0, 0.5, -0.5], 44100, 1);
//! let out = gain.process(chunk).unwrap();
//! assert_eq!(out.data(), &[0.5, -0.5, 0.25, -0.25]);
//! ```
/// Operator-overloaded graph combinators for pipeline composition.
/// Hardware audio I/O nodes backed by [`cpal`](https://docs.rs/cpal).
/// Built-in processing nodes.
pub use Chunk;
pub use StreamError;
pub use ;
pub use DspNode;
pub use ;