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
//! Defines the traits [`Map`] and [`Mut`].
//!
//! These traits serve two main purposes:
//!
//! - Implementing custom curves, that can be played back as samples via [`gen::Once`] or
//! [`gen::Loop`]. See the [`gen`] module for more info.
//!
//! - Create signals that modify others, either sample-wise via [`MapSgn`](crate::eff::MapSgn), or
//! by directly tweaking parameters via [`MutSgn`](crate::eff::MutSgn) or
//! [`ModSgn`](crate::eff::ModSgn).
//!
//! In many cases, one can use a Rust function, wrapped in a [`Func`] struct. However, in cases
//! where one wants control over this function, or to create multiple instances of it, one is
//! encouraged to implement these traits for their own custom structs.
pub use *;
pub use *;
use PhantomData;
use crate*;
/// Rescales a value from `-1.0` to `1.0`, into a value from `0.0` to `1.0`.
/// Rescales a value from `0.0` to `1.0`, into a value from `-1.0` to `1.0`.
/// An abstract trait for a structure representing a function `X → Y`.
///
/// Due to orphan rules, this trait can't be implemented directly for Rust functions. Instead, you
/// must wrap your function in an [`Func`].
/// An abstract trait for a structure representing a function which modifies a [`Signal`].
///
/// Due to orphan rules, this trait can't be implemented directly for Rust functions. Instead, you
/// must wrap your function in a [`Func`].
/// An abstract trait for a structure representing a function which modifies a [`Signal`] according
/// to an envelope.
///
/// Due to orphan rules, this trait can't be implemented directly for Rust functions. Instead, you
/// must wrap your function in a [`Func`].
/// A wrapper for a Rust function which converts it into a [`Map`] or [`Mut`].
///
/// Unfortunately, it may be necessary to explicitly write down the types of the arguments to the
/// function.