History

trying out different doc comment format

Matthew Wang committed 6 years ago

Commit 60960e31 parent 67e74121 file · +218 −425Browse files

Unified · Split

leaf/Inc/leaf-oscillators.h+218−425
@@ -18,136 +18,121 @@ extern "C" { · 17 unmodified lines
18#include "leaf-tables.h"18#include "leaf-tables.h"
19#include "leaf-filters.h"19#include "leaf-filters.h"
20 20
21
21 /*!22 /*!
22 * Header.23 Header.
23 * @include basic-oscillators.h24 @include basic-oscillators.h
24 * @example basic-oscillators.c25 @example basic-oscillators.c
25 * An example.26 An example.
26 */27 */
28
27 29
28 //==============================================================================30 //==============================================================================
29 31
30 typedef struct _tCycle
31 {
32 tMempool mempool;
33 // Underlying phasor
34 float phase;
35 float inc,freq;
36 } _tCycle;
37
38 typedef _tCycle* tCycle;
39
40 /*!32 /*!
41 * @defgroup tcycle tCycle33 @defgroup tcycle tCycle
42 * @ingroup oscillators34 @ingroup oscillators
43 * @brief A cycle/sine waveform oscillator. Uses wavetable synthesis.35 @brief A cycle/sine waveform oscillator. Uses wavetable synthesis.
44 * @{36 @{
45 */37 */
46 38
47 //! Initialize a tCycle to the default LEAF mempool.
48 /*!39 /*!
40 @fn void tCycle_init (tCycle* const osc)
41 @brief Initialize a tCycle to the default LEAF mempool.
49 @param osc A pointer to the tCycle to be initialized.42 @param osc A pointer to the tCycle to be initialized.
50 */43 */
51 void tCycle_init (tCycle* const osc);
52 44
53
54 //! Initialize a tCycle to a specified mempool.
55 /*!45 /*!
46 @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool)
47 @brief Initialize a tCycle to a specified mempool.
56 @param osc A pointer to the tCycle to be initialized.48 @param osc A pointer to the tCycle to be initialized.
57 @param pool A pointer to the tMempool to which the tCycle should be initialized.49 @param pool A pointer to the tMempool to which the tCycle should be initialized.
58 */50 */
59 void tCycle_initToPool (tCycle* const osc, tMempool* const pool);
60
61 51
62 //! Free a tCycle from the default LEAF mempool.
63 /*!52 /*!
53 @fn void tCycle_free (tCycle* const osc)
54 @brief Free a tCycle from the default LEAF mempool.
64 @param osc A pointer to the tCycle to be freed.55 @param osc A pointer to the tCycle to be freed.
65 */56 */
66 void tCycle_free (tCycle* const osc);
67
68 57
69 //! Tick a tCycle oscillator.
70 /*!58 /*!
59 @fn float tCycle_tick (tCycle* const osc)
60 @brief Tick a tCycle oscillator.
71 @param osc A pointer to the relevant tCycle.61 @param osc A pointer to the relevant tCycle.
72 @return The ticked sample as a float from -1 to 1.62 @return The ticked sample as a float from -1 to 1.
73 */63 */
74 float tCycle_tick (tCycle* const osc);
75 64
76
77 //! Set the frequency of a tCycle oscillator.
78 /*!65 /*!
66 @fn void tCycle_setFreq (tCycle* const osc, float freq)
67 @brief Set the frequency of a tCycle oscillator.
79 @param osc A pointer to the relevant tCycle.68 @param osc A pointer to the relevant tCycle.
80 @param freq The frequency to set the oscillator to.69 @param freq The frequency to set the oscillator to.
81 */70 */
82 void tCycle_setFreq (tCycle* const osc, float freq);
83 71
84 /*! @} */72 /*! @} */
85 73
86 //==============================================================================74 typedef struct _tCycle
87
88 /* tTriangle: Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components. */
89 typedef struct _tTriangle
90 {75 {
91 tMempool mempool;76 tMempool mempool;
92 // Underlying phasor77 // Underlying phasor
93 float phase;78 float phase;
94 float inc,freq;79 float inc,freq;
95 int oct;80 } _tCycle;
96 float w;
97 } _tTriangle;
98 81
99 typedef _tTriangle* tTriangle;82 typedef _tCycle* tCycle;
83
84 void tCycle_init (tCycle* const osc);
85 void tCycle_initToPool (tCycle* const osc, tMempool* const pool);
86 void tCycle_free (tCycle* const osc);
87
88 float tCycle_tick (tCycle* const osc);
89 void tCycle_setFreq (tCycle* const osc, float freq);
90
91 //==============================================================================
100 92
101 /*!93 /*!
102 * @defgroup ttriangle tTriangle94 @defgroup ttriangle tTriangle
103 * @ingroup oscillators95 @ingroup oscillators
104 * @brief An anti-aliased triangle waveform oscillator. Uses wavetable synthesis.96 @brief Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components.
105 * @{97 @{
106 */98 */
107 99
108 //! Initialize a tTriangle to the default LEAF mempool.
109 /*!100 /*!
101 @fn void tTriangle_init (tTriangle* const osc)
102 @brief Initialize a tTriangle to the default LEAF mempool.
110 @param osc A pointer to the tTriangle to be initialized.103 @param osc A pointer to the tTriangle to be initialized.
111 */104 */
112 void tTriangle_init (tTriangle* const osc);
113
114 105
115 //! Initialize a tTriangle to a specified mempool.
116 /*!106 /*!
107 @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool)
108 @brief Initialize a tTriangle to a specified mempool.
117 @param osc A pointer to the tTriangle to be initialized.109 @param osc A pointer to the tTriangle to be initialized.
118 @param pool A pointer to the tMempool to which the tTriangle should be initialized.110 @param pool A pointer to the tMempool to which the tTriangle should be initialized.
119 */111 */
120 void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool);
121 112
122
123 //! Free a tTriangle from the default LEAF mempool.
124 /*!113 /*!
114 @fn void tTriangle_free (tTriangle* const osc)
115 @brief Free a tTriangle from the default LEAF mempool.
125 @param osc A pointer to the tTriangle to be freed.116 @param osc A pointer to the tTriangle to be freed.
126 */117 */
127 void tTriangle_free (tTriangle* const osc);
128
129 118
130 //! Tick a tTriangle oscillator.
131 /*!119 /*!
120 @fn float tTriangle_tick (tTriangle* const osc)
121 @brief Tick a tTriangle oscillator.
132 @param osc A pointer to the relevant tTriangle.122 @param osc A pointer to the relevant tTriangle.
133 @return The ticked sample as a float from -1 to 1.123 @return The ticked sample as a float from -1 to 1.
134 */124 */
135 float tTriangle_tick (tTriangle* const osc);
136
137 125
138 //! Set the frequency of a tTriangle oscillator.
139 /*!126 /*!
127 @fn void tTriangle_setFreq (tTriangle* const osc, float freq)
128 @brief Set the frequency of a tTriangle oscillator.
140 @param osc A pointer to the relevant tTriangle.129 @param osc A pointer to the relevant tTriangle.
141 @param freq The frequency to set the oscillator to.130 @param freq The frequency to set the oscillator to.
142 */131 */
143 void tTriangle_setFreq (tTriangle* const osc, float freq);
144 132
145 /*! @} */133 /*! @} */
146 134
147 //==============================================================================135 typedef struct _tTriangle
148
149 /* tSquare: Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components. */
150 typedef struct _tSquare
151 {136 {
152 tMempool mempool;137 tMempool mempool;
153 // Underlying phasor138 // Underlying phasor
@@ -155,60 +140,63 @@ extern "C" { · 1 unmodified line
155 float inc,freq;140 float inc,freq;
156 int oct;141 int oct;
157 float w;142 float w;
158 } _tSquare;143 } _tTriangle;
159 144
160 typedef _tSquare* tSquare;145 typedef _tTriangle* tTriangle;
146
147 void tTriangle_init (tTriangle* const osc);
148 void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool);
149 void tTriangle_free (tTriangle* const osc);
150
151 float tTriangle_tick (tTriangle* const osc);
152 void tTriangle_setFreq (tTriangle* const osc, float freq);
153
154
155 //==============================================================================
161 156
162 /*!157 /*!
163 * @defgroup tsquare tSquare158 @defgroup tsquare tSquare
164 * @ingroup oscillators159 @ingroup oscillators
165 * @brief An anti-aliased square waveform oscillator. Uses wavetable synthesis.160 @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
166 * @{161 @{
167 */162 */
168 163
169 //! Initialize a tSquare to the default LEAF mempool.
170 /*!164 /*!
165 @fn void tSquare_init (tSquare* const osc)
166 @brief Initialize a tSquare to the default LEAF mempool.
171 @param osc A pointer to the tSquare to be initialized.167 @param osc A pointer to the tSquare to be initialized.
172 */168 */
173 void tSquare_init (tSquare* const osc);
174
175 169
176 //! Initialize a tSquare to a specified mempool.
177 /*!170 /*!
171 @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool)
172 @brief Initialize a tSquare to a specified mempool.
178 @param osc A pointer to the tSquare to be initialized.173 @param osc A pointer to the tSquare to be initialized.
179 @param pool A pointer to the tMempool to which the tSquare should be initialized.174 @param pool A pointer to the tMempool to which the tSquare should be initialized.
180 */175 */
181 void tSquare_initToPool (tSquare* const osc, tMempool* const);
182
183 176
184 //! Free a tSquare from the default LEAF mempool.
185 /*!177 /*!
178 @fn void tSquare_free (tSquare* const osc)
179 @brief Free a tSquare from the default LEAF mempool.
186 @param osc A pointer to the tSquare to be freed.180 @param osc A pointer to the tSquare to be freed.
187 */181 */
188 void tSquare_free (tSquare* const osc);
189 182
190
191 //! Tick a tSquare oscillator.
192 /*!183 /*!
184 @fn float tSquare_tick (tSquare* const osc)
185 @brief Tick a tSquare oscillator.
193 @param osc A pointer to the relevant tSquare.186 @param osc A pointer to the relevant tSquare.
194 @return The ticked sample as a float from -1 to 1.187 @return The ticked sample as a float from -1 to 1.
195 */188 */
196 float tSquare_tick (tSquare* const osc);
197
198 189
199 //! Set the frequency of a tSquare oscillator.
200 /*!190 /*!
191 @fn void tSquare_setFreq (tSquare* const osc, float freq)
192 @brief Set the frequency of a tSquare oscillator.
201 @param osc A pointer to the relevant tSquare.193 @param osc A pointer to the relevant tSquare.
202 @param freq The frequency to set the oscillator to.194 @param freq The frequency to set the oscillator to.
203 */195 */
204 void tSquare_setFreq (tSquare* const osc, float freq);
205 196
206 /*! @} */197 /*! @} */
207 198
208 //==============================================================================199 typedef struct _tSquare
209
210 /* tSawtooth: Anti-aliased Sawtooth waveform using wavetable interpolation. Wavetables constructed from sine components. */
211 typedef struct _tSawtooth
212 {200 {
213 tMempool mempool;201 tMempool mempool;
214 // Underlying phasor202 // Underlying phasor
@@ -216,58 +204,86 @@ extern "C" { · 1 unmodified line
216 float inc,freq;204 float inc,freq;
217 int oct;205 int oct;
218 float w;206 float w;
219 } _tSawtooth;207 } _tSquare;
220 208
221 typedef _tSawtooth* tSawtooth;209 typedef _tSquare* tSquare;
210
211 void tSquare_init (tSquare* const osc);
212 void tSquare_initToPool (tSquare* const osc, tMempool* const);
213 void tSquare_free (tSquare* const osc);
214
215 float tSquare_tick (tSquare* const osc);
216 void tSquare_setFreq (tSquare* const osc, float freq);
217
218 /*! @} */
219
220 //==============================================================================
222 221
223 /*!222 /*!
224 * @defgroup tsawtooth tSawtooth223 @defgroup tsawtooth tSawtooth
225 * @ingroup oscillators224 @ingroup oscillators
226 * @brief An anti-aliased sawtooth waveform oscillator. Uses wavetable synthesis.225 @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
227 * @{226 @{
228 */227 */
229 228
230 //! Initialize a tSawtooth to the default LEAF mempool.
231 /*!229 /*!
230 @fn void tSawtooth_init (tSawtooth* const osc)
231 @brief Initialize a tSawtooth to the default LEAF mempool.
232 @param osc A pointer to the tSawtooth to be initialized.232 @param osc A pointer to the tSawtooth to be initialized.
233 */233 */
234 void tSawtooth_init (tSawtooth* const osc);
235 234
236
237 //! Initialize a tSawtooth to a specified mempool.
238 /*!235 /*!
236 @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool)
237 @brief Initialize a tSawtooth to a specified mempool.
239 @param osc A pointer to the tSawtooth to be initialized.238 @param osc A pointer to the tSawtooth to be initialized.
240 @param pool A pointer to the tMempool to which the tSawtooth should be initialized.239 @param pool A pointer to the tMempool to which the tSawtooth should be initialized.
241 */240 */
242 void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool);
243 241
244
245 //! Free a tSawtooth from the default LEAF mempool.
246 /*!242 /*!
243 @fn void tSawtooth_free (tSawtooth* const osc)
244 @brief Free a tSawtooth from the default LEAF mempool.
247 @param osc A pointer to the tSawtooth to be freed.245 @param osc A pointer to the tSawtooth to be freed.
248 */246 */
249 void tSawtooth_free (tSawtooth* const osc);
250 247
251
252 //! Tick a tSawtooth oscillator.
253 /*!248 /*!
249 @fn float tSawtooth_tick (tSawtooth* const osc)
250 @brief Tick a tSawtooth oscillator.
254 @param osc A pointer to the relevant tSawtooth.251 @param osc A pointer to the relevant tSawtooth.
255 @return The ticked sample as a float from -1 to 1.252 @return The ticked sample as a float from -1 to 1.
256 */253 */
257 float tSawtooth_tick (tSawtooth* const osc);
258
259 254
260 //! Set the frequency of a tSawtooth oscillator.
261 /*!255 /*!
256 @fn void tSawtooth_setFreq (tSawtooth* const osc, float freq)
257 @brief Set the frequency of a tSawtooth oscillator.
262 @param osc A pointer to the relevant tSawtooth.258 @param osc A pointer to the relevant tSawtooth.
263 @param freq The frequency to set the oscillator to.259 @param freq The frequency to set the oscillator to.
264 */260 */
265 void tSawtooth_setFreq (tSawtooth* const osc, float freq);
266 261
267 /*! @} */262 /*! @} */
268 263
264 typedef struct _tSawtooth
265 {
266 tMempool mempool;
267 // Underlying phasor
268 float phase;
269 float inc,freq;
270 int oct;
271 float w;
272 } _tSawtooth;
273
274 typedef _tSawtooth* tSawtooth;
275
276 void tSawtooth_init (tSawtooth* const osc);
277 void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool);
278 void tSawtooth_free (tSawtooth* const osc);
279
280 float tSawtooth_tick (tSawtooth* const osc);
281 void tSawtooth_setFreq (tSawtooth* const osc, float freq);
282
269 //==============================================================================283 //==============================================================================
270 284
285
286 // TO BE REMOVED
271 typedef struct _tSine287 typedef struct _tSine
272 {288 {
273 tMempool mempool;289 tMempool mempool;
@@ -279,55 +295,15 @@ extern "C" { · 5 unmodified lines
279 295
280 typedef _tSine* tSine;296 typedef _tSine* tSine;
281 297
282 /*!
283 * @defgroup tsine tSine
284 * @ingroup oscillators
285 * @brief A cycle/sine waveform oscillator.
286 * @{
287 */
288
289 //! Initialize a tSine to the default LEAF mempool.
290 /*!
291 @param osc A pointer to the tSine to be initialized.
292 */
293 void tSine_init (tSine* const osc, int size);298 void tSine_init (tSine* const osc, int size);
294
295
296 //! Initialize a tSine to a specified mempool.
297 /*!
298 @param osc A pointer to the tSine to be initialized.
299 @param pool A pointer to the tMempool to which the tSine should be initialized.
300 */
301 void tSine_initToPool (tSine* const osc, int size, tMempool* const pool);299 void tSine_initToPool (tSine* const osc, int size, tMempool* const pool);
302 300
303
304 //! Free a tSine from the default LEAF mempool.
305 /*!
306 @param osc A pointer to the tSine to be freed.
307 */
308 void tSine_free (tSine* const osc);301 void tSine_free (tSine* const osc);
309
310
311 //! Tick a tSine oscillator.
312 /*!
313 @param osc A pointer to the relevant tSine.
314 @return The ticked sample as a float from -1 to 1.
315 */
316 float tSine_tick (tSine* const osc);302 float tSine_tick (tSine* const osc);
317
318
319 //! Set the frequency of a tSine oscillator.
320 /*!
321 @param osc A pointer to the relevant tSine.
322 @param freq The frequency to set the oscillator to.
323 */
324 void tSine_setFreq (tSine* const osc, float freq);303 void tSine_setFreq (tSine* const osc, float freq);
325 304
326 /*! @} */
327
328 //==============================================================================305 //==============================================================================
329 306
330 /* tTri: Anti-aliased Triangle waveform using wavetable interpolation. */
331 typedef struct _tTri307 typedef struct _tTri
332 {308 {
333 tMempool mempool;309 tMempool mempool;
@@ -339,57 +315,18 @@ extern "C" { · 5 unmodified lines
339 315
340 typedef _tTri* tTri;316 typedef _tTri* tTri;
341 317
342 /*!
343 * @defgroup tTri tTri
344 * @ingroup oscillators
345 * @brief An anti-aliased triangle waveform oscillator.
346 * @{
347 */
348
349 //! Initialize a tTri to the default LEAF mempool.
350 /*!
351 @param osc A pointer to the tTri to be initialized.
352 */
353 void tTri_init (tTri* const osc);318 void tTri_init (tTri* const osc);
354
355
356 //! Initialize a tTri to a specified mempool.
357 /*!
358 @param osc A pointer to the tTri to be initialized.
359 @param pool A pointer to the tMempool to which the tTri should be initialized.
360 */
361 void tTri_initToPool (tTri* const osc, tMempool* const pool);319 void tTri_initToPool (tTri* const osc, tMempool* const pool);
362
363
364 //! Free a tTri from the default LEAF mempool.
365 /*!
366 @param osc A pointer to the tTri to be freed.
367 */
368 void tTri_free (tTri* const osc);320 void tTri_free (tTri* const osc);
369 321
370
371 //! Tick a tTri oscillator.
372 /*!
373 @param osc A pointer to the relevant tTri.
374 @return The ticked sample as a float from -1 to 1.
375 */
376 float tTri_tick (tTri* const osc);322 float tTri_tick (tTri* const osc);
377
378
379 //! Set the frequency of a tTri oscillator.
380 /*!
381 @param osc A pointer to the relevant tTriangle.
382 @param freq The frequency to set the oscillator to.
383 */
384 void tTri_setFreq (tTri* const osc, float freq);323 void tTri_setFreq (tTri* const osc, float freq);
385
386 void tTri_setSkew (tTri* const osc, float skew);324 void tTri_setSkew (tTri* const osc, float skew);
387 325
388 /*! @} */326 /*! @} */
389 327
390 //==============================================================================328 //==============================================================================
391 329
392 /* tPulse: Anti-aliased Square waveform. */
393 typedef struct _tPulse330 typedef struct _tPulse
394 {331 {
395 tMempool mempool;332 tMempool mempool;
@@ -400,57 +337,16 @@ extern "C" { · 4 unmodified lines
400 337
401 typedef _tPulse* tPulse;338 typedef _tPulse* tPulse;
402 339
403 /*!
404 * @defgroup tPulse tPulse
405 * @ingroup oscillators
406 * @brief An anti-aliased pulse waveform oscillator with changeable pulse width.
407 * @{
408 */
409
410 //! Initialize a tPulse to the default LEAF mempool.
411 /*!
412 @param osc A pointer to the tPulse to be initialized.
413 */
414 void tPulse_init (tPulse* const osc);340 void tPulse_init (tPulse* const osc);
415
416
417 //! Initialize a tPulse to a specified mempool.
418 /*!
419 @param osc A pointer to the tPulse to be initialized.
420 @param pool A pointer to the tMempool to which the tPulse should be initialized.
421 */
422 void tPulse_initToPool (tPulse* const osc, tMempool* const);341 void tPulse_initToPool (tPulse* const osc, tMempool* const);
423
424
425 //! Free a tPulse from the default LEAF mempool.
426 /*!
427 @param osc A pointer to the tPulse to be freed.
428 */
429 void tPulse_free (tPulse* const osc);342 void tPulse_free (tPulse* const osc);
430 343
431
432 //! Tick a tPulse oscillator.
433 /*!
434 @param osc A pointer to the relevant tPulse.
435 @return The ticked sample as a float from -1 to 1.
436 */
437 float tPulse_tick (tPulse* const osc);344 float tPulse_tick (tPulse* const osc);
438
439
440 //! Set the frequency of a tPulse oscillator.
441 /*!
442 @param osc A pointer to the relevant tPulse.
443 @param freq The frequency to set the oscillator to.
444 */
445 void tPulse_setFreq (tPulse* const osc, float freq);345 void tPulse_setFreq (tPulse* const osc, float freq);
446
447 void tPulse_setWidth (tPulse* const osc, float width);346 void tPulse_setWidth (tPulse* const osc, float width);
448 347
449 /*! @} */
450
451 //==============================================================================348 //==============================================================================
452 349
453 /* tSawtooth: Anti-aliased Sawtooth waveform. */
454 typedef struct _tSaw350 typedef struct _tSaw
455 {351 {
456 tMempool mempool;352 tMempool mempool;
@@ -460,55 +356,15 @@ extern "C" { · 3 unmodified lines
460 356
461 typedef _tSaw* tSaw;357 typedef _tSaw* tSaw;
462 358
463 /*!
464 * @defgroup tsaw tSaw
465 * @ingroup oscillators
466 * @brief An anti-aliased sawtooth waveform oscillator. Uses wavetable synthesis.
467 * @{
468 */
469
470 //! Initialize a tSaw to the default LEAF mempool.
471 /*!
472 @param osc A pointer to the tSaw to be initialized.
473 */
474 void tSaw_init (tSaw* const osc);359 void tSaw_init (tSaw* const osc);
475
476
477 //! Initialize a tSaw to a specified mempool.
478 /*!
479 @param osc A pointer to the tSaw to be initialized.
480 @param pool A pointer to the tMempool to which the tSaw should be initialized.
481 */
482 void tSaw_initToPool (tSaw* const osc, tMempool* const pool);360 void tSaw_initToPool (tSaw* const osc, tMempool* const pool);
483
484
485 //! Free a tSaw from the default LEAF mempool.
486 /*!
487 @param osc A pointer to the tSaw to be freed.
488 */
489 void tSaw_free (tSaw* const osc);361 void tSaw_free (tSaw* const osc);
490 362
491
492 //! Tick a tSaw oscillator.
493 /*!
494 @param osc A pointer to the relevant tSaw.
495 @return The ticked sample as a float from -1 to 1.
496 */
497 float tSaw_tick (tSaw* const osc);363 float tSaw_tick (tSaw* const osc);
498
499
500 //! Set the frequency of a tSaw oscillator.
501 /*!
502 @param osc A pointer to the relevant tSaw.
503 @param freq The frequency to set the oscillator to.
504 */
505 void tSaw_setFreq (tSaw* const osc, float freq);364 void tSaw_setFreq (tSaw* const osc, float freq);
506 365
507 /*! @} */
508
509 //==============================================================================366 //==============================================================================
510 367
511 /* tPhasor: Aliasing phasor [0.0, 1.0) */
512 typedef struct _tPhasor368 typedef struct _tPhasor
513 {369 {
514 tMempool mempool;370 tMempool mempool;
@@ -519,61 +375,15 @@ extern "C" { · 4 unmodified lines
519 375
520 typedef _tPhasor* tPhasor;376 typedef _tPhasor* tPhasor;
521 377
522 /*!
523 * @defgroup tphasor Phasor
524 * @ingroup oscillators
525 * @brief An aliasing phasor.
526 * @{
527 */
528
529 //! Initialize a tPhasor to the default LEAF mempool.
530 /*!
531 @param osc A pointer to the tPhasor to be initialized.
532 */
533 void tPhasor_init (tPhasor* const osc);378 void tPhasor_init (tPhasor* const osc);
534
535
536 //! Initialize a tPhasor to a specified mempool.
537 /*!
538 @param osc A pointer to the tPhasor to be initialized.
539 @param pool A pointer to the tMempool to which the tPhasor should be initialized.
540 */
541 void tPhasor_initToPool (tPhasor* const osc, tMempool* const);379 void tPhasor_initToPool (tPhasor* const osc, tMempool* const);
542
543
544 //! Free a tPhasor from the default LEAF mempool.
545 /*!
546 @param osc A pointer to the tPhasor to be freed.
547 */
548 void tPhasor_free (tPhasor* const osc);380 void tPhasor_free (tPhasor* const osc);
549 381
550
551 //! Tick a tPhasor oscillator.
552 /*!
553 @param osc A pointer to the relevant tPhasor.
554 @return The ticked sample as a float from 0 to 1.
555 */
556 float tPhasor_tick (tPhasor* const osc);382 float tPhasor_tick (tPhasor* const osc);
557
558
559 //! Set the frequency of a tPhasor oscillator.
560 /*!
561 @param osc A pointer to the relevant tPhasor.
562 @param freq The frequency to set the oscillator to.
563 */
564 void tPhasor_setFreq (tPhasor* const osc, float freq);383 void tPhasor_setFreq (tPhasor* const osc, float freq);
565 384
566 /*! @} */
567
568 //==============================================================================385 //==============================================================================
569 386
570 /*!
571 * @defgroup tnoise tNoise
572 * @ingroup oscillators
573 * @brief A noise generator.
574 * @{
575 */
576
577 /* tNoise. WhiteNoise, PinkNoise. */387 /* tNoise. WhiteNoise, PinkNoise. */
578 /*!388 /*!
579 * Noise types389 * Noise types
@@ -596,198 +406,179 @@ extern "C" { · 16 unmodified lines
596 } _tNoise;406 } _tNoise;
597 407
598 typedef _tNoise* tNoise;408 typedef _tNoise* tNoise;
599 409
600 //! Initialize a tNoise to the default LEAF mempool.
601 /*!
602 @param osc A pointer to the tNoise to be initialized.
603 */
604 void tNoise_init (tNoise* const noise, NoiseType type);410 void tNoise_init (tNoise* const noise, NoiseType type);
605
606
607 //! Initialize a tNoise to a specified mempool.
608 /*!
609 @param osc A pointer to the tNoise to be initialized.
610 @param pool A pointer to the tMempool to which the tNoise should be initialized.
611 */
612 void tNoise_initToPool (tNoise* const noise, NoiseType type, tMempool* const);411 void tNoise_initToPool (tNoise* const noise, NoiseType type, tMempool* const);
613
614
615 //! Free a tNoise from the default LEAF mempool.
616 /*!
617 @param osc A pointer to the tNoise to be freed.
618 */
619 void tNoise_free (tNoise* const noise);412 void tNoise_free (tNoise* const noise);
620 413
621
622 //! Tick a tNoise oscillator.
623 /*!
624 @param osc A pointer to the relevant tNoise.
625 @return The ticked sample as a float from -1 to 1.
626 */
627 float tNoise_tick (tNoise* const noise);414 float tNoise_tick (tNoise* const noise);
628 415
629 /*! @} */
630
631 //==============================================================================416 //==============================================================================
632 417
633 /*!418 /*!
634 * @defgroup tneuron tNeuron419 @defgroup tneuron tNeuron
635 * @ingroup oscillators420 @ingroup oscillators
636 * @brief A model of a neuron, adapted to act as an oscillator.421 @brief A model of a neuron, adapted to act as an oscillator.
637 * @{422 @{
638 */423 */
639 424
640 /*!425 /*!
641 * Neuron modes426 @fn void tNeuron_init (tNeuron* const neuron)
642 */427 @brief Initialize a tNeuron to the default LEAF mempool.
643 enum NeuronMode
644 {
645 NeuronNormal, //!< Normal operation
646 NeuronTanh, //!< Tanh voltage shaping
647 NeuronAaltoShaper, //!< Aalto voltage shaping
648 NeuronModeNil
649 };
650 typedef enum NeuronMode NeuronMode;
651
652 typedef struct _tNeuron
653 {
654 tMempool mempool;
655
656 tPoleZero f;
657
658 NeuronMode mode;
659
660 float voltage, current;
661 float timeStep;
662
663 float alpha[3];
664 float beta[3];
665 float rate[3];
666 float V[3];
667 float P[3];
668 float gK, gN, gL, C;
669 } _tNeuron;
670
671 typedef _tNeuron* tNeuron;
672
673 //! Initialize a tNeuron to the default LEAF mempool.
674 /*!
675 @param neuron A pointer to the tNeuron to be initialized.428 @param neuron A pointer to the tNeuron to be initialized.
676 */429 */
677 void tNeuron_init (tNeuron* const neuron);
678
679 430
680 //! Initialize a tNeuron to a specified mempool.
681 /*!431 /*!
432 @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool)
433 @brief Initialize a tNeuron to a specified mempool.
682 @param neuron A pointer to the tNeuron to be initialized.434 @param neuron A pointer to the tNeuron to be initialized.
683 @param pool A pointer to the tMempool to which the tNeuron should be initialized.435 @param pool A pointer to the tMempool to which the tNeuron should be initialized.
684 */436 */
685 void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool);
686 437
687
688 //! Free a tNeuron from the default LEAF mempool.
689 /*!438 /*!
439 @fn void tNeuron_free (tNeuron* const neuron)
440 @brief Free a tNeuron from the default LEAF mempool.
690 @param neuron A pointer to the tNeuron to be freed.441 @param neuron A pointer to the tNeuron to be freed.
691 */442 */
692 void tNeuron_free (tNeuron* const neuron);
693
694 443
695 //! Reset the neuron model.
696 /*!444 /*!
445 @fn void tNeuron_reset (tNeuron* const neuron)
446 @brief Reset the neuron model.
697 @param neuron A pointer to the relevant tNeuron.447 @param neuron A pointer to the relevant tNeuron.
698 */448 */
699 void tNeuron_reset (tNeuron* const neuron);
700
701 449
702 //! Tick a tNeuron oscillator.
703 /*!450 /*!
451 @fn float tNeuron_tick (tNeuron* const neuron)
452 @brief Tick a tNeuron oscillator.
704 @param neuron A pointer to the relevant tNeuron.453 @param neuron A pointer to the relevant tNeuron.
705 @return The ticked sample as a float from -1 to 1.454 @return The ticked sample as a float from -1 to 1.
706 */455 */
707 float tNeuron_tick (tNeuron* const neuron);456
708
709
710 //! Set the tNeuron shaping mode.
711 /*!457 /*!
458 @fn void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode)
459 @brief Set the tNeuron shaping mode.
712 @param neuron A pointer to the relevant tNeuron.460 @param neuron A pointer to the relevant tNeuron.
713 @param mode The mode to set the tNeuron to.461 @param mode The mode to set the tNeuron to.
714 */462 */
715 void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode);463
716
717
718 //! Set the current.
719 /*!464 /*!
465 @fn void tNeuron_setCurrent (tNeuron* const neuron, float current)
466 @brief Set the current.
720 @param neuron A pointer to the relevant tNeuron.467 @param neuron A pointer to the relevant tNeuron.
721 @param current The new current.468 @param current The new current.
722 */469 */
723 void tNeuron_setCurrent (tNeuron* const neuron, float current);
724
725 470
726 //! Set the potassium value.
727 /*!471 /*!
472 @fn void tNeuron_setK (tNeuron* const neuron, float K)
473 @brief Set the potassium value.
728 @param neuron A pointer to the relevant tNeuron.474 @param neuron A pointer to the relevant tNeuron.
729 @param K The new potassium.475 @param K The new potassium.
730 */476 */
731 void tNeuron_setK (tNeuron* const neuron, float K);
732
733 477
734 //! Set the chloride value.
735 /*!478 /*!
479 @fn void tNeuron_setL (tNeuron* const neuron, float L)
480 @brief Set the chloride value.
736 @param neuron A pointer to the relevant tNeuron.481 @param neuron A pointer to the relevant tNeuron.
737 @param L The new chloride value.482 @param L The new chloride value.
738 */483 */
739 void tNeuron_setL (tNeuron* const neuron, float L);
740 484
741
742 //! Set the sodium value.
743 /*!485 /*!
486 @fn void tNeuron_setN (tNeuron* const neuron, float N)
487 @brief Set the sodium value.
744 @param neuron A pointer to the relevant tNeuron.488 @param neuron A pointer to the relevant tNeuron.
745 @param N The new sodium value.489 @param N The new sodium value.
746 */490 */
747 void tNeuron_setN (tNeuron* const neuron, float N);
748
749 491
750 //! Set the calcium value.
751 /*!492 /*!
493 @fn void tNeuron_setC (tNeuron* const neuron, float C)
494 @brief Set the calcium value.
752 @param neuron A pointer to the relevant tNeuron.495 @param neuron A pointer to the relevant tNeuron.
753 @param C The new calcium.496 @param C The new calcium.
754 */497 */
755 void tNeuron_setC (tNeuron* const neuron, float C);
756
757 498
758 //! Set the V1 value.
759 /*!499 /*!
500 @fn void tNeuron_setV1 (tNeuron* const neuron, float V1)
501 @brief Set the V1 value.
760 @param neuron A pointer to the relevant tNeuron.502 @param neuron A pointer to the relevant tNeuron.
761 @param V1 The new V1.503 @param V1 The new V1.
762 */504 */
763 void tNeuron_setV1 (tNeuron* const neuron, float V1);
764 505
765
766 //! Set the V2 value.
767 /*!506 /*!
507 @fn void tNeuron_setV2 (tNeuron* const neuron, float V2)
508 @brief Set the V2 value.
768 @param neuron A pointer to the relevant tNeuron.509 @param neuron A pointer to the relevant tNeuron.
769 @param V2 The new V2.510 @param V2 The new V2.
770 */511 */
771 void tNeuron_setV2 (tNeuron* const neuron, float V2);
772
773 512
774 //! Set the V3 value.
775 /*!513 /*!
514 @fn void tNeuron_setV3 (tNeuron* const neuron, float V3)
515 @brief Set the V3 value.
776 @param neuron A pointer to the relevant tNeuron.516 @param neuron A pointer to the relevant tNeuron.
777 @param V3 The new V3.517 @param V3 The new V3.
778 */518 */
779 void tNeuron_setV3 (tNeuron* const neuron, float V3);
780
781 519
782 //! Set the time step.
783 /*!520 /*!
521 @fn void tNeuron_setTimeStep (tNeuron* const neuron, float timestep)
522 @brief Set the time step of the model.
784 @param neuron A pointer to the relevant tNeuron.523 @param neuron A pointer to the relevant tNeuron.
785 @param timestep The new time step524 @param timestep The new time step.
786 */525 */
787 void tNeuron_setTimeStep (tNeuron* const neuron, float timestep);526
527 /*!
528 @brief Shaping modes for tNeuron output.
529 */
530 enum NeuronMode
531 {
532 NeuronNormal, //!< Normal operation
533 NeuronTanh, //!< Tanh voltage shaping
534 NeuronAaltoShaper, //!< Aalto voltage shaping
535 NeuronModeNil
536 };
788 537
789 /*! @} */538 /*! @} */
790 539
540 typedef enum NeuronMode NeuronMode;
541
542 typedef struct _tNeuron
543 {
544 tMempool mempool;
545
546 tPoleZero f;
547
548 NeuronMode mode;
549
550 float voltage, current;
551 float timeStep;
552
553 float alpha[3];
554 float beta[3];
555 float rate[3];
556 float V[3];
557 float P[3];
558 float gK, gN, gL, C;
559 } _tNeuron;
560
561 typedef _tNeuron* tNeuron;
562
563 void tNeuron_init (tNeuron* const neuron);
564 void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool);
565 void tNeuron_free (tNeuron* const neuron);
566
567 void tNeuron_reset (tNeuron* const neuron);
568 float tNeuron_tick (tNeuron* const neuron);
569 void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode);
570 void tNeuron_setCurrent (tNeuron* const neuron, float current);
571 void tNeuron_setK (tNeuron* const neuron, float K);
572 void tNeuron_setL (tNeuron* const neuron, float L);
573 void tNeuron_setN (tNeuron* const neuron, float N);
574 void tNeuron_setC (tNeuron* const neuron, float C);
575 void tNeuron_setV1 (tNeuron* const neuron, float V1);
576 void tNeuron_setV2 (tNeuron* const neuron, float V2);
577 void tNeuron_setV3 (tNeuron* const neuron, float V3);
578 void tNeuron_setTimeStep (tNeuron* const neuron, float timestep);
579
580
581
791 //==============================================================================582 //==============================================================================
792 583
793#define FILLEN 256584#define FILLEN 256
@@ -888,3 +679,5 @@ extern "C" { · 94 unmodified lines
888 679
889//==============================================================================680//==============================================================================
890 681
682
683

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t