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
use ;
use NonZero;
/// Sample rate (a frame rate or samples per second per channel).
pub type SampleRate = ;
/// Number of channels in a stream. Can never be Zero
pub type ChannelCount = ;
/// Number of bits per sample. Can never be zero.
pub type BitDepth = ;
// NOTE on numeric precision:
//
// While `f32` is transparent for typical playback use cases, it does not guarantee preservation of
// full 24-bit source fidelity across arbitrary processing chains. Each floating-point operation
// rounds its result to `f32` precision (~24-bit significand). In DSP pipelines (filters, mixing,
// modulation), many operations are applied per sample and over time, so rounding noise accumulates
// and long-running state (e.g. oscillator phase) can drift.
//
// For use cases where numerical accuracy must be preserved through extended processing (recording,
// editing, analysis, long-running generators, or complex DSP graphs), enabling 64-bit processing
// reduces accumulated rounding error and drift.
//
// This mirrors common practice in professional audio software and DSP libraries, which often use
// 64-bit internal processing even when the final output is 16- or 24-bit.
/// Floating point type used for internal calculations. Can be configured to be
/// either `f32` (default) or `f64` using the `64bit` feature flag.
pub type Float = f32;
/// Floating point type used for internal calculations. Can be configured to be
/// either `f32` (default) or `f64` using the `64bit` feature flag.
pub type Float = f64;
/// Represents value of a single sample.
/// Silence corresponds to the value `0.0`. The expected amplitude range is -1.0...1.0.
/// Values below and above this range are clipped in conversion to other sample types.
/// Use conversion traits from [dasp_sample] crate or [crate::conversions::SampleTypeConverter]
/// to convert between sample types if necessary.
pub type Sample = Float;
/// Used to test at compile time that a struct/enum implements Send, Sync and
/// is 'static. These are common requirements for dynamic error management
/// libs like color-eyre and anyhow
///
/// # Examples
/// ```compile_fail
/// struct NotSend {
/// foo: Rc<String>,
/// }
///
/// assert_error_traits!(NotSend)
/// ```
///
/// ```compile_fail
/// struct NotSync {
/// foo: std::cell::RefCell<String>,
/// }
/// assert_error_traits!(NotSync)
/// ```
///
/// ```compile_fail
/// struct NotStatic<'a> {
/// foo: &'a str,
/// }
///
/// assert_error_traits!(NotStatic)
/// ```
pub use assert_error_traits;
pub const