-
Notifications
You must be signed in to change notification settings - Fork 0
/
library.h
150 lines (133 loc) · 4.81 KB
/
library.h
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
#ifndef COMPRESSOR_LIBRARY_H
#define COMPRESSOR_LIBRARY_H
#include "m_pd.h"
#include "compressor.h"
////////////////////////////////////////////////////////////
/// Static compressor instance
////////////////////////////////////////////////////////////
static t_class *compressor_tilde_class;
////////////////////////////////////////////////////////////
/// \brief Structure defining the pd object
////////////////////////////////////////////////////////////
typedef struct t_compressor_tilde {
t_object x_obj;
// Inputs
t_float in;
t_inlet *in2;
t_inlet *in3;
t_inlet *in4;
t_inlet *in5;
t_inlet *in6;
// Outputs
t_outlet *out;
t_outlet *out2;
t_outlet *out3;
// DSP instance
t_compressor *compressor;
} t_compressor_tilde;
////////////////////////////////////////////////////////////
/// \brief Main DSP function
///
/// This functions does the main DSP computations.
///
/// \param w Pointer to a compressor instance and input/output arrays
///
/// \return A pointer to the data space for the next DSP object
///
////////////////////////////////////////////////////////////
t_int *compressor_tilde_perform(t_int *w);
////////////////////////////////////////////////////////////
/// \brief Threshold setter
///
/// This functions passes the threshold to the compressor.
///
/// \param x Pointer to a pd compressor instance
/// \param threshold New value for the threshold
///
////////////////////////////////////////////////////////////
void compressor_tilde_set_threshold(t_compressor_tilde *x, t_floatarg threshold);
////////////////////////////////////////////////////////////
/// \brief Ratio setter
///
/// This functions passes the ratio to the compressor.
///
/// \param x Pointer to a pd compressor instance
/// \param ratio New value for the ratio
///
////////////////////////////////////////////////////////////
void compressor_tilde_set_ratio(t_compressor_tilde *x, t_floatarg ratio);
////////////////////////////////////////////////////////////
/// \brief Attack setter
///
/// This functions passes the attack to the compressor.
///
/// \param x Pointer to a pd compressor instance
/// \param attack New value for the attack
///
////////////////////////////////////////////////////////////
void compressor_tilde_set_attack(t_compressor_tilde *x, t_floatarg attack);
////////////////////////////////////////////////////////////
/// \brief Release setter
///
/// This functions passes the release to the compressor.
///
/// \param x Pointer to a pd compressor instance
/// \param release New value for the release
///
////////////////////////////////////////////////////////////
void compressor_tilde_set_release(t_compressor_tilde *x, t_floatarg release);
////////////////////////////////////////////////////////////
/// \brief Post gain setter
///
/// This functions passes the post gain to the compressor.
///
/// \param x Pointer to a pd compressor instance
/// \param post_gain New value for the post gain
///
////////////////////////////////////////////////////////////
void compressor_tilde_set_post_gain(t_compressor_tilde *x, t_floatarg post_gain);
////////////////////////////////////////////////////////////
/// \brief Add compressor to the signal chain
///
/// This functions adds the object to the signal chain.
/// Required by PD. It also initialized the sample rate.
///
/// \param x Pointer to a pd compressor instance
/// \param sp A pointer to the input and output arrays
///
////////////////////////////////////////////////////////////
void compressor_tilde_dsp(t_compressor_tilde *x, t_signal **sp);
////////////////////////////////////////////////////////////
/// \brief Instanciate new compressor instance
///
/// This functions instanciate a new pd compressor instance. It is
/// possible to construct the new object with up to 5
/// initialization arguments. These are, in order: threshold,
/// ratio, attack, release and post gain.
///
/// \param argc Number of initialization arguments (range [0, 5])
/// \param argv Values for the initialization arguments.
///
/// \returns A pointer to the new instance
///
////////////////////////////////////////////////////////////
void *compressor_tilde_new(int argc, t_atom *argv);
////////////////////////////////////////////////////////////
/// \brief Free a compressor instance
///
/// This functions frees the memory acquired by a pd compressor
/// instance.
///
/// \param x Pointer to a pd compressor instance
///
////////////////////////////////////////////////////////////
void compressor_tilde_free(t_compressor_tilde *x);
////////////////////////////////////////////////////////////
/// \brief Free a pd compressor instance
///
/// This functions registers the pd compressor struct and methods
/// to PDs system.
///
////////////////////////////////////////////////////////////
void compressor_tilde_setup(void);
#endif