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
1818 #include "leaf-tables.h"
1919 #include "leaf-filters.h"
2020
21+
2122 /*!
22− * Header.
23− * @include basic-oscillators.h
24− * @example basic-oscillators.c
25− * An example.
23+ Header.
24+ @include basic-oscillators.h
25+ @example basic-oscillators.c
26+ An example.
2627 */
28+
2729
2830 //==============================================================================
2931
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−
4032 /*!
41− * @defgroup tcycle tCycle
42− * @ingroup oscillators
43− * @brief A cycle/sine waveform oscillator. Uses wavetable synthesis.
44− * @{
33+ @defgroup tcycle tCycle
34+ @ingroup oscillators
35+ @brief A cycle/sine waveform oscillator. Uses wavetable synthesis.
36+ @{
4537 */
4638
47− //! Initialize a tCycle to the default LEAF mempool.
4839 /*!
40+ @fn void tCycle_init (tCycle* const osc)
41+ @brief Initialize a tCycle to the default LEAF mempool.
4942 @param osc A pointer to the tCycle to be initialized.
5043 */
51− void tCycle_init (tCycle* const osc);
5244
53−
54− //! Initialize a tCycle to a specified mempool.
5545 /*!
46+ @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool)
47+ @brief Initialize a tCycle to a specified mempool.
5648 @param osc A pointer to the tCycle to be initialized.
5749 @param pool A pointer to the tMempool to which the tCycle should be initialized.
5850 */
59− void tCycle_initToPool (tCycle* const osc, tMempool* const pool);
60−
6151
62− //! Free a tCycle from the default LEAF mempool.
6352 /*!
53+ @fn void tCycle_free (tCycle* const osc)
54+ @brief Free a tCycle from the default LEAF mempool.
6455 @param osc A pointer to the tCycle to be freed.
6556 */
66− void tCycle_free (tCycle* const osc);
67−
6857
69− //! Tick a tCycle oscillator.
7058 /*!
59+ @fn float tCycle_tick (tCycle* const osc)
60+ @brief Tick a tCycle oscillator.
7161 @param osc A pointer to the relevant tCycle.
7262 @return The ticked sample as a float from -1 to 1.
7363 */
74− float tCycle_tick (tCycle* const osc);
7564
76−
77− //! Set the frequency of a tCycle oscillator.
7865 /*!
66+ @fn void tCycle_setFreq (tCycle* const osc, float freq)
67+ @brief Set the frequency of a tCycle oscillator.
7968 @param osc A pointer to the relevant tCycle.
8069 @param freq The frequency to set the oscillator to.
8170 */
82− void tCycle_setFreq (tCycle* const osc, float freq);
8371
8472 /*! @} */
8573
86− //==============================================================================
87−
88− /* tTriangle: Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components. */
89− typedef struct _tTriangle
74+ typedef struct _tCycle
9075 {
9176 tMempool mempool;
9277 // Underlying phasor
9378 float phase;
9479 float inc,freq;
95− int oct;
96− float w;
97− } _tTriangle;
80+ } _tCycle;
9881
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+ //==============================================================================
10092
10193 /*!
102− * @defgroup ttriangle tTriangle
103− * @ingroup oscillators
104− * @brief An anti-aliased triangle waveform oscillator. Uses wavetable synthesis.
105− * @{
94+ @defgroup ttriangle tTriangle
95+ @ingroup oscillators
96+ @brief Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components.
97+ @{
10698 */
10799
108− //! Initialize a tTriangle to the default LEAF mempool.
109100 /*!
101+ @fn void tTriangle_init (tTriangle* const osc)
102+ @brief Initialize a tTriangle to the default LEAF mempool.
110103 @param osc A pointer to the tTriangle to be initialized.
111104 */
112− void tTriangle_init (tTriangle* const osc);
113−
114105
115− //! Initialize a tTriangle to a specified mempool.
116106 /*!
107+ @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool)
108+ @brief Initialize a tTriangle to a specified mempool.
117109 @param osc A pointer to the tTriangle to be initialized.
118110 @param pool A pointer to the tMempool to which the tTriangle should be initialized.
119111 */
120− void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool);
121112
122−
123− //! Free a tTriangle from the default LEAF mempool.
124113 /*!
114+ @fn void tTriangle_free (tTriangle* const osc)
115+ @brief Free a tTriangle from the default LEAF mempool.
125116 @param osc A pointer to the tTriangle to be freed.
126117 */
127− void tTriangle_free (tTriangle* const osc);
128−
129118
130− //! Tick a tTriangle oscillator.
131119 /*!
120+ @fn float tTriangle_tick (tTriangle* const osc)
121+ @brief Tick a tTriangle oscillator.
132122 @param osc A pointer to the relevant tTriangle.
133123 @return The ticked sample as a float from -1 to 1.
134124 */
135− float tTriangle_tick (tTriangle* const osc);
136−
137125
138− //! Set the frequency of a tTriangle oscillator.
139126 /*!
127+ @fn void tTriangle_setFreq (tTriangle* const osc, float freq)
128+ @brief Set the frequency of a tTriangle oscillator.
140129 @param osc A pointer to the relevant tTriangle.
141130 @param freq The frequency to set the oscillator to.
142131 */
143− void tTriangle_setFreq (tTriangle* const osc, float freq);
144132
145133 /*! @} */
146−
147− //==============================================================================
148−
149− /* tSquare: Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components. */
150− typedef struct _tSquare
134+
135+ typedef struct _tTriangle
151136 {
152137 tMempool mempool;
153138 // Underlying phasor
@@ -155,60 +140,63 @@ extern "C" { · 1 unmodified line
155140 float inc,freq;
156141 int oct;
157142 float w;
158− } _tSquare;
143+ } _tTriangle;
159144
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+ //==============================================================================
161156
162157 /*!
163− * @defgroup tsquare tSquare
164− * @ingroup oscillators
165− * @brief An anti-aliased square waveform oscillator. Uses wavetable synthesis.
166− * @{
158+ @defgroup tsquare tSquare
159+ @ingroup oscillators
160+ @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
161+ @{
167162 */
168163
169− //! Initialize a tSquare to the default LEAF mempool.
170164 /*!
165+ @fn void tSquare_init (tSquare* const osc)
166+ @brief Initialize a tSquare to the default LEAF mempool.
171167 @param osc A pointer to the tSquare to be initialized.
172168 */
173− void tSquare_init (tSquare* const osc);
174−
175169
176− //! Initialize a tSquare to a specified mempool.
177170 /*!
171+ @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool)
172+ @brief Initialize a tSquare to a specified mempool.
178173 @param osc A pointer to the tSquare to be initialized.
179174 @param pool A pointer to the tMempool to which the tSquare should be initialized.
180175 */
181− void tSquare_initToPool (tSquare* const osc, tMempool* const);
182−
183176
184− //! Free a tSquare from the default LEAF mempool.
185177 /*!
178+ @fn void tSquare_free (tSquare* const osc)
179+ @brief Free a tSquare from the default LEAF mempool.
186180 @param osc A pointer to the tSquare to be freed.
187181 */
188− void tSquare_free (tSquare* const osc);
189182
190−
191− //! Tick a tSquare oscillator.
192183 /*!
184+ @fn float tSquare_tick (tSquare* const osc)
185+ @brief Tick a tSquare oscillator.
193186 @param osc A pointer to the relevant tSquare.
194187 @return The ticked sample as a float from -1 to 1.
195188 */
196− float tSquare_tick (tSquare* const osc);
197−
198189
199− //! Set the frequency of a tSquare oscillator.
200190 /*!
191+ @fn void tSquare_setFreq (tSquare* const osc, float freq)
192+ @brief Set the frequency of a tSquare oscillator.
201193 @param osc A pointer to the relevant tSquare.
202194 @param freq The frequency to set the oscillator to.
203195 */
204− void tSquare_setFreq (tSquare* const osc, float freq);
205196
206197 /*! @} */
207198
208− //==============================================================================
209−
210− /* tSawtooth: Anti-aliased Sawtooth waveform using wavetable interpolation. Wavetables constructed from sine components. */
211− typedef struct _tSawtooth
199+ typedef struct _tSquare
212200 {
213201 tMempool mempool;
214202 // Underlying phasor
@@ -216,58 +204,86 @@ extern "C" { · 1 unmodified line
216204 float inc,freq;
217205 int oct;
218206 float w;
219− } _tSawtooth;
207+ } _tSquare;
220208
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+ //==============================================================================
222221
223222 /*!
224− * @defgroup tsawtooth tSawtooth
225− * @ingroup oscillators
226− * @brief An anti-aliased sawtooth waveform oscillator. Uses wavetable synthesis.
227− * @{
223+ @defgroup tsawtooth tSawtooth
224+ @ingroup oscillators
225+ @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
226+ @{
228227 */
229228
230− //! Initialize a tSawtooth to the default LEAF mempool.
231229 /*!
230+ @fn void tSawtooth_init (tSawtooth* const osc)
231+ @brief Initialize a tSawtooth to the default LEAF mempool.
232232 @param osc A pointer to the tSawtooth to be initialized.
233233 */
234− void tSawtooth_init (tSawtooth* const osc);
235234
236−
237− //! Initialize a tSawtooth to a specified mempool.
238235 /*!
236+ @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool)
237+ @brief Initialize a tSawtooth to a specified mempool.
239238 @param osc A pointer to the tSawtooth to be initialized.
240239 @param pool A pointer to the tMempool to which the tSawtooth should be initialized.
241240 */
242− void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool);
243241
244−
245− //! Free a tSawtooth from the default LEAF mempool.
246242 /*!
243+ @fn void tSawtooth_free (tSawtooth* const osc)
244+ @brief Free a tSawtooth from the default LEAF mempool.
247245 @param osc A pointer to the tSawtooth to be freed.
248246 */
249− void tSawtooth_free (tSawtooth* const osc);
250247
251−
252− //! Tick a tSawtooth oscillator.
253248 /*!
249+ @fn float tSawtooth_tick (tSawtooth* const osc)
250+ @brief Tick a tSawtooth oscillator.
254251 @param osc A pointer to the relevant tSawtooth.
255252 @return The ticked sample as a float from -1 to 1.
256253 */
257− float tSawtooth_tick (tSawtooth* const osc);
258−
259254
260− //! Set the frequency of a tSawtooth oscillator.
261255 /*!
256+ @fn void tSawtooth_setFreq (tSawtooth* const osc, float freq)
257+ @brief Set the frequency of a tSawtooth oscillator.
262258 @param osc A pointer to the relevant tSawtooth.
263259 @param freq The frequency to set the oscillator to.
264260 */
265− void tSawtooth_setFreq (tSawtooth* const osc, float freq);
266261
267262 /*! @} */
268263
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+
269283 //==============================================================================
270284
285+
286+ // TO BE REMOVED
271287 typedef struct _tSine
272288 {
273289 tMempool mempool;
@@ -279,55 +295,15 @@ extern "C" { · 5 unmodified lines
279295
280296 typedef _tSine* tSine;
281297
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− */
293298 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− */
301299 void tSine_initToPool (tSine* const osc, int size, tMempool* const pool);
302−
303−
304− //! Free a tSine from the default LEAF mempool.
305− /*!
306− @param osc A pointer to the tSine to be freed.
307− */
300+
308301 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− */
316302 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− */
324303 void tSine_setFreq (tSine* const osc, float freq);
325304
326− /*! @} */
327−
328305 //==============================================================================
329−
330− /* tTri: Anti-aliased Triangle waveform using wavetable interpolation. */
306+
331307 typedef struct _tTri
332308 {
333309 tMempool mempool;
@@ -339,57 +315,18 @@ extern "C" { · 5 unmodified lines
339315
340316 typedef _tTri* tTri;
341317
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− */
353318 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− */
361319 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− */
368320 void tTri_free (tTri* const osc);
369321
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− */
376322 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− */
384323 void tTri_setFreq (tTri* const osc, float freq);
385−
386324 void tTri_setSkew (tTri* const osc, float skew);
387325
388326 /*! @} */
389327
390328 //==============================================================================
391329
392− /* tPulse: Anti-aliased Square waveform. */
393330 typedef struct _tPulse
394331 {
395332 tMempool mempool;
@@ -400,57 +337,16 @@ extern "C" { · 4 unmodified lines
400337
401338 typedef _tPulse* tPulse;
402339
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− */
414340 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− */
422341 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− */
429342 void tPulse_free (tPulse* const osc);
430343
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− */
437344 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− */
445345 void tPulse_setFreq (tPulse* const osc, float freq);
446−
447346 void tPulse_setWidth (tPulse* const osc, float width);
448347
449− /*! @} */
450−
451348 //==============================================================================
452349
453− /* tSawtooth: Anti-aliased Sawtooth waveform. */
454350 typedef struct _tSaw
455351 {
456352 tMempool mempool;
@@ -460,55 +356,15 @@ extern "C" { · 3 unmodified lines
460356
461357 typedef _tSaw* tSaw;
462358
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− */
474359 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− */
482360 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− */
489361 void tSaw_free (tSaw* const osc);
490362
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− */
497363 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− */
505364 void tSaw_setFreq (tSaw* const osc, float freq);
506365
507− /*! @} */
508−
509366 //==============================================================================
510367
511− /* tPhasor: Aliasing phasor [0.0, 1.0) */
512368 typedef struct _tPhasor
513369 {
514370 tMempool mempool;
@@ -519,61 +375,15 @@ extern "C" { · 4 unmodified lines
519375
520376 typedef _tPhasor* tPhasor;
521377
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− */
533378 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− */
541379 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− */
548380 void tPhasor_free (tPhasor* const osc);
549381
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− */
556382 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− */
564383 void tPhasor_setFreq (tPhasor* const osc, float freq);
565384
566− /*! @} */
567−
568385 //==============================================================================
569386
570− /*!
571− * @defgroup tnoise tNoise
572− * @ingroup oscillators
573− * @brief A noise generator.
574− * @{
575− */
576−
577387 /* tNoise. WhiteNoise, PinkNoise. */
578388 /*!
579389 * Noise types
@@ -596,198 +406,179 @@ extern "C" { · 16 unmodified lines
596406 } _tNoise;
597407
598408 typedef _tNoise* tNoise;
599−
600− //! Initialize a tNoise to the default LEAF mempool.
601− /*!
602− @param osc A pointer to the tNoise to be initialized.
603− */
409+
604410 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− */
612411 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− */
619412 void tNoise_free (tNoise* const noise);
620413
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− */
627414 float tNoise_tick (tNoise* const noise);
628415
629− /*! @} */
630−
631416 //==============================================================================
632417
633418 /*!
634− * @defgroup tneuron tNeuron
635− * @ingroup oscillators
636− * @brief A model of a neuron, adapted to act as an oscillator.
637− * @{
419+ @defgroup tneuron tNeuron
420+ @ingroup oscillators
421+ @brief A model of a neuron, adapted to act as an oscillator.
422+ @{
638423 */
639424
640425 /*!
641− * Neuron modes
642− */
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− /*!
426+ @fn void tNeuron_init (tNeuron* const neuron)
427+ @brief Initialize a tNeuron to the default LEAF mempool.
675428 @param neuron A pointer to the tNeuron to be initialized.
676429 */
677− void tNeuron_init (tNeuron* const neuron);
678−
679430
680− //! Initialize a tNeuron to a specified mempool.
681431 /*!
432+ @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool)
433+ @brief Initialize a tNeuron to a specified mempool.
682434 @param neuron A pointer to the tNeuron to be initialized.
683435 @param pool A pointer to the tMempool to which the tNeuron should be initialized.
684436 */
685− void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool);
686437
687−
688− //! Free a tNeuron from the default LEAF mempool.
689438 /*!
439+ @fn void tNeuron_free (tNeuron* const neuron)
440+ @brief Free a tNeuron from the default LEAF mempool.
690441 @param neuron A pointer to the tNeuron to be freed.
691442 */
692− void tNeuron_free (tNeuron* const neuron);
693−
694443
695− //! Reset the neuron model.
696444 /*!
445+ @fn void tNeuron_reset (tNeuron* const neuron)
446+ @brief Reset the neuron model.
697447 @param neuron A pointer to the relevant tNeuron.
698448 */
699− void tNeuron_reset (tNeuron* const neuron);
700−
701449
702− //! Tick a tNeuron oscillator.
703450 /*!
451+ @fn float tNeuron_tick (tNeuron* const neuron)
452+ @brief Tick a tNeuron oscillator.
704453 @param neuron A pointer to the relevant tNeuron.
705454 @return The ticked sample as a float from -1 to 1.
706455 */
707− float tNeuron_tick (tNeuron* const neuron);
708−
709−
710− //! Set the tNeuron shaping mode.
456+
711457 /*!
458+ @fn void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode)
459+ @brief Set the tNeuron shaping mode.
712460 @param neuron A pointer to the relevant tNeuron.
713461 @param mode The mode to set the tNeuron to.
714462 */
715− void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode);
716−
717−
718− //! Set the current.
463+
719464 /*!
465+ @fn void tNeuron_setCurrent (tNeuron* const neuron, float current)
466+ @brief Set the current.
720467 @param neuron A pointer to the relevant tNeuron.
721468 @param current The new current.
722469 */
723− void tNeuron_setCurrent (tNeuron* const neuron, float current);
724−
725470
726− //! Set the potassium value.
727471 /*!
472+ @fn void tNeuron_setK (tNeuron* const neuron, float K)
473+ @brief Set the potassium value.
728474 @param neuron A pointer to the relevant tNeuron.
729475 @param K The new potassium.
730476 */
731− void tNeuron_setK (tNeuron* const neuron, float K);
732−
733477
734− //! Set the chloride value.
735478 /*!
479+ @fn void tNeuron_setL (tNeuron* const neuron, float L)
480+ @brief Set the chloride value.
736481 @param neuron A pointer to the relevant tNeuron.
737482 @param L The new chloride value.
738483 */
739− void tNeuron_setL (tNeuron* const neuron, float L);
740484
741−
742− //! Set the sodium value.
743485 /*!
486+ @fn void tNeuron_setN (tNeuron* const neuron, float N)
487+ @brief Set the sodium value.
744488 @param neuron A pointer to the relevant tNeuron.
745489 @param N The new sodium value.
746490 */
747− void tNeuron_setN (tNeuron* const neuron, float N);
748−
749491
750− //! Set the calcium value.
751492 /*!
493+ @fn void tNeuron_setC (tNeuron* const neuron, float C)
494+ @brief Set the calcium value.
752495 @param neuron A pointer to the relevant tNeuron.
753496 @param C The new calcium.
754497 */
755− void tNeuron_setC (tNeuron* const neuron, float C);
756−
757498
758− //! Set the V1 value.
759499 /*!
500+ @fn void tNeuron_setV1 (tNeuron* const neuron, float V1)
501+ @brief Set the V1 value.
760502 @param neuron A pointer to the relevant tNeuron.
761503 @param V1 The new V1.
762504 */
763− void tNeuron_setV1 (tNeuron* const neuron, float V1);
764505
765−
766− //! Set the V2 value.
767506 /*!
507+ @fn void tNeuron_setV2 (tNeuron* const neuron, float V2)
508+ @brief Set the V2 value.
768509 @param neuron A pointer to the relevant tNeuron.
769510 @param V2 The new V2.
770511 */
771− void tNeuron_setV2 (tNeuron* const neuron, float V2);
772−
773512
774− //! Set the V3 value.
775513 /*!
514+ @fn void tNeuron_setV3 (tNeuron* const neuron, float V3)
515+ @brief Set the V3 value.
776516 @param neuron A pointer to the relevant tNeuron.
777517 @param V3 The new V3.
778518 */
779− void tNeuron_setV3 (tNeuron* const neuron, float V3);
780−
781519
782− //! Set the time step.
783520 /*!
521+ @fn void tNeuron_setTimeStep (tNeuron* const neuron, float timestep)
522+ @brief Set the time step of the model.
784523 @param neuron A pointer to the relevant tNeuron.
785− @param timestep The new time step
524+ @param timestep The new time step.
786525 */
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+ };
788537
789538 /*! @} */
790539
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+
791582 //==============================================================================
792583
793584 #define FILLEN 256
@@ -888,3 +679,5 @@ extern "C" { · 94 unmodified lines
888679
889680 //==============================================================================
890681
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