ref: 60960e32079f61b1f0dca9520b2395803d384eea
parent: 67e741209764939ffc3d018bafdbcf524d2d52cf
author: Matthew Wang <mjw7@princeton.edu>
date: Fri Jun 26 13:34:58 EDT 2020
trying out different doc comment format
--- a/leaf/Inc/leaf-oscillators.h
+++ b/leaf/Inc/leaf-oscillators.h
@@ -18,136 +18,121 @@
#include "leaf-tables.h"
#include "leaf-filters.h"
+
/*!
- * Header.
- * @include basic-oscillators.h
- * @example basic-oscillators.c
- * An example.
+ Header.
+ @include basic-oscillators.h
+ @example basic-oscillators.c
+ An example.
*/
+
//==============================================================================
- typedef struct _tCycle
- {
- tMempool mempool;
- // Underlying phasor
- float phase;
- float inc,freq;
- } _tCycle;
-
- typedef _tCycle* tCycle;
-
/*!
- * @defgroup tcycle tCycle
- * @ingroup oscillators
- * @brief A cycle/sine waveform oscillator. Uses wavetable synthesis.
- * @{
+ @defgroup tcycle tCycle
+ @ingroup oscillators
+ @brief A cycle/sine waveform oscillator. Uses wavetable synthesis.
+ @{
*/
- //! Initialize a tCycle to the default LEAF mempool.
/*!
+ @fn void tCycle_init (tCycle* const osc)
+ @brief Initialize a tCycle to the default LEAF mempool.
@param osc A pointer to the tCycle to be initialized.
*/
- void tCycle_init (tCycle* const osc);
-
- //! Initialize a tCycle to a specified mempool.
/*!
+ @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool)
+ @brief Initialize a tCycle to a specified mempool.
@param osc A pointer to the tCycle to be initialized.
@param pool A pointer to the tMempool to which the tCycle should be initialized.
*/
- void tCycle_initToPool (tCycle* const osc, tMempool* const pool);
-
- //! Free a tCycle from the default LEAF mempool.
/*!
+ @fn void tCycle_free (tCycle* const osc)
+ @brief Free a tCycle from the default LEAF mempool.
@param osc A pointer to the tCycle to be freed.
*/
- void tCycle_free (tCycle* const osc);
-
- //! Tick a tCycle oscillator.
/*!
+ @fn float tCycle_tick (tCycle* const osc)
+ @brief Tick a tCycle oscillator.
@param osc A pointer to the relevant tCycle.
@return The ticked sample as a float from -1 to 1.
*/
- float tCycle_tick (tCycle* const osc);
-
- //! Set the frequency of a tCycle oscillator.
/*!
+ @fn void tCycle_setFreq (tCycle* const osc, float freq)
+ @brief Set the frequency of a tCycle oscillator.
@param osc A pointer to the relevant tCycle.
@param freq The frequency to set the oscillator to.
*/
- void tCycle_setFreq (tCycle* const osc, float freq);
/*! @} */
- //==============================================================================
-
- /* tTriangle: Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components. */
- typedef struct _tTriangle
+ typedef struct _tCycle
{
tMempool mempool;
// Underlying phasor
float phase;
float inc,freq;
- int oct;
- float w;
- } _tTriangle;
+ } _tCycle;
- typedef _tTriangle* tTriangle;
+ typedef _tCycle* tCycle;
+ void tCycle_init (tCycle* const osc);
+ void tCycle_initToPool (tCycle* const osc, tMempool* const pool);
+ void tCycle_free (tCycle* const osc);
+
+ float tCycle_tick (tCycle* const osc);
+ void tCycle_setFreq (tCycle* const osc, float freq);
+
+ //==============================================================================
+
/*!
- * @defgroup ttriangle tTriangle
- * @ingroup oscillators
- * @brief An anti-aliased triangle waveform oscillator. Uses wavetable synthesis.
- * @{
+ @defgroup ttriangle tTriangle
+ @ingroup oscillators
+ @brief Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components.
+ @{
*/
- //! Initialize a tTriangle to the default LEAF mempool.
/*!
+ @fn void tTriangle_init (tTriangle* const osc)
+ @brief Initialize a tTriangle to the default LEAF mempool.
@param osc A pointer to the tTriangle to be initialized.
*/
- void tTriangle_init (tTriangle* const osc);
-
- //! Initialize a tTriangle to a specified mempool.
/*!
+ @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool)
+ @brief Initialize a tTriangle to a specified mempool.
@param osc A pointer to the tTriangle to be initialized.
@param pool A pointer to the tMempool to which the tTriangle should be initialized.
*/
- void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool);
-
- //! Free a tTriangle from the default LEAF mempool.
/*!
+ @fn void tTriangle_free (tTriangle* const osc)
+ @brief Free a tTriangle from the default LEAF mempool.
@param osc A pointer to the tTriangle to be freed.
*/
- void tTriangle_free (tTriangle* const osc);
-
- //! Tick a tTriangle oscillator.
/*!
+ @fn float tTriangle_tick (tTriangle* const osc)
+ @brief Tick a tTriangle oscillator.
@param osc A pointer to the relevant tTriangle.
@return The ticked sample as a float from -1 to 1.
*/
- float tTriangle_tick (tTriangle* const osc);
-
- //! Set the frequency of a tTriangle oscillator.
/*!
+ @fn void tTriangle_setFreq (tTriangle* const osc, float freq)
+ @brief Set the frequency of a tTriangle oscillator.
@param osc A pointer to the relevant tTriangle.
@param freq The frequency to set the oscillator to.
*/
- void tTriangle_setFreq (tTriangle* const osc, float freq);
/*! @} */
-
- //==============================================================================
-
- /* tSquare: Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components. */
- typedef struct _tSquare
+
+ typedef struct _tTriangle
{
tMempool mempool;
// Underlying phasor
@@ -155,60 +140,63 @@
float inc,freq;
int oct;
float w;
- } _tSquare;
+ } _tTriangle;
- typedef _tSquare* tSquare;
+ typedef _tTriangle* tTriangle;
+
+ void tTriangle_init (tTriangle* const osc);
+ void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool);
+ void tTriangle_free (tTriangle* const osc);
+ float tTriangle_tick (tTriangle* const osc);
+ void tTriangle_setFreq (tTriangle* const osc, float freq);
+
+
+ //==============================================================================
+
/*!
- * @defgroup tsquare tSquare
- * @ingroup oscillators
- * @brief An anti-aliased square waveform oscillator. Uses wavetable synthesis.
- * @{
+ @defgroup tsquare tSquare
+ @ingroup oscillators
+ @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
+ @{
*/
- //! Initialize a tSquare to the default LEAF mempool.
/*!
+ @fn void tSquare_init (tSquare* const osc)
+ @brief Initialize a tSquare to the default LEAF mempool.
@param osc A pointer to the tSquare to be initialized.
*/
- void tSquare_init (tSquare* const osc);
-
- //! Initialize a tSquare to a specified mempool.
/*!
+ @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool)
+ @brief Initialize a tSquare to a specified mempool.
@param osc A pointer to the tSquare to be initialized.
@param pool A pointer to the tMempool to which the tSquare should be initialized.
*/
- void tSquare_initToPool (tSquare* const osc, tMempool* const);
-
- //! Free a tSquare from the default LEAF mempool.
/*!
+ @fn void tSquare_free (tSquare* const osc)
+ @brief Free a tSquare from the default LEAF mempool.
@param osc A pointer to the tSquare to be freed.
*/
- void tSquare_free (tSquare* const osc);
-
- //! Tick a tSquare oscillator.
/*!
+ @fn float tSquare_tick (tSquare* const osc)
+ @brief Tick a tSquare oscillator.
@param osc A pointer to the relevant tSquare.
@return The ticked sample as a float from -1 to 1.
*/
- float tSquare_tick (tSquare* const osc);
-
- //! Set the frequency of a tSquare oscillator.
/*!
+ @fn void tSquare_setFreq (tSquare* const osc, float freq)
+ @brief Set the frequency of a tSquare oscillator.
@param osc A pointer to the relevant tSquare.
@param freq The frequency to set the oscillator to.
*/
- void tSquare_setFreq (tSquare* const osc, float freq);
/*! @} */
- //==============================================================================
-
- /* tSawtooth: Anti-aliased Sawtooth waveform using wavetable interpolation. Wavetables constructed from sine components. */
- typedef struct _tSawtooth
+ typedef struct _tSquare
{
tMempool mempool;
// Underlying phasor
@@ -216,58 +204,86 @@
float inc,freq;
int oct;
float w;
- } _tSawtooth;
+ } _tSquare;
- typedef _tSawtooth* tSawtooth;
+ typedef _tSquare* tSquare;
+
+ void tSquare_init (tSquare* const osc);
+ void tSquare_initToPool (tSquare* const osc, tMempool* const);
+ void tSquare_free (tSquare* const osc);
+
+ float tSquare_tick (tSquare* const osc);
+ void tSquare_setFreq (tSquare* const osc, float freq);
+ /*! @} */
+
+ //==============================================================================
+
/*!
- * @defgroup tsawtooth tSawtooth
- * @ingroup oscillators
- * @brief An anti-aliased sawtooth waveform oscillator. Uses wavetable synthesis.
- * @{
+ @defgroup tsawtooth tSawtooth
+ @ingroup oscillators
+ @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components.
+ @{
*/
- //! Initialize a tSawtooth to the default LEAF mempool.
/*!
+ @fn void tSawtooth_init (tSawtooth* const osc)
+ @brief Initialize a tSawtooth to the default LEAF mempool.
@param osc A pointer to the tSawtooth to be initialized.
*/
- void tSawtooth_init (tSawtooth* const osc);
-
- //! Initialize a tSawtooth to a specified mempool.
/*!
+ @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool)
+ @brief Initialize a tSawtooth to a specified mempool.
@param osc A pointer to the tSawtooth to be initialized.
@param pool A pointer to the tMempool to which the tSawtooth should be initialized.
*/
- void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool);
-
- //! Free a tSawtooth from the default LEAF mempool.
/*!
+ @fn void tSawtooth_free (tSawtooth* const osc)
+ @brief Free a tSawtooth from the default LEAF mempool.
@param osc A pointer to the tSawtooth to be freed.
*/
- void tSawtooth_free (tSawtooth* const osc);
-
- //! Tick a tSawtooth oscillator.
/*!
+ @fn float tSawtooth_tick (tSawtooth* const osc)
+ @brief Tick a tSawtooth oscillator.
@param osc A pointer to the relevant tSawtooth.
@return The ticked sample as a float from -1 to 1.
*/
- float tSawtooth_tick (tSawtooth* const osc);
-
- //! Set the frequency of a tSawtooth oscillator.
/*!
+ @fn void tSawtooth_setFreq (tSawtooth* const osc, float freq)
+ @brief Set the frequency of a tSawtooth oscillator.
@param osc A pointer to the relevant tSawtooth.
@param freq The frequency to set the oscillator to.
*/
- void tSawtooth_setFreq (tSawtooth* const osc, float freq);
/*! @} */
+ typedef struct _tSawtooth
+ {
+ tMempool mempool;
+ // Underlying phasor
+ float phase;
+ float inc,freq;
+ int oct;
+ float w;
+ } _tSawtooth;
+
+ typedef _tSawtooth* tSawtooth;
+
+ void tSawtooth_init (tSawtooth* const osc);
+ void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool);
+ void tSawtooth_free (tSawtooth* const osc);
+
+ float tSawtooth_tick (tSawtooth* const osc);
+ void tSawtooth_setFreq (tSawtooth* const osc, float freq);
+
//==============================================================================
+
+ // TO BE REMOVED
typedef struct _tSine
{
tMempool mempool;
@@ -279,55 +295,15 @@
typedef _tSine* tSine;
- /*!
- * @defgroup tsine tSine
- * @ingroup oscillators
- * @brief A cycle/sine waveform oscillator.
- * @{
- */
-
- //! Initialize a tSine to the default LEAF mempool.
- /*!
- @param osc A pointer to the tSine to be initialized.
- */
void tSine_init (tSine* const osc, int size);
-
-
- //! Initialize a tSine to a specified mempool.
- /*!
- @param osc A pointer to the tSine to be initialized.
- @param pool A pointer to the tMempool to which the tSine should be initialized.
- */
void tSine_initToPool (tSine* const osc, int size, tMempool* const pool);
-
-
- //! Free a tSine from the default LEAF mempool.
- /*!
- @param osc A pointer to the tSine to be freed.
- */
+
void tSine_free (tSine* const osc);
-
-
- //! Tick a tSine oscillator.
- /*!
- @param osc A pointer to the relevant tSine.
- @return The ticked sample as a float from -1 to 1.
- */
float tSine_tick (tSine* const osc);
-
-
- //! Set the frequency of a tSine oscillator.
- /*!
- @param osc A pointer to the relevant tSine.
- @param freq The frequency to set the oscillator to.
- */
void tSine_setFreq (tSine* const osc, float freq);
- /*! @} */
-
//==============================================================================
-
- /* tTri: Anti-aliased Triangle waveform using wavetable interpolation. */
+
typedef struct _tTri
{
tMempool mempool;
@@ -339,50 +315,12 @@
typedef _tTri* tTri;
- /*!
- * @defgroup tTri tTri
- * @ingroup oscillators
- * @brief An anti-aliased triangle waveform oscillator.
- * @{
- */
-
- //! Initialize a tTri to the default LEAF mempool.
- /*!
- @param osc A pointer to the tTri to be initialized.
- */
void tTri_init (tTri* const osc);
-
-
- //! Initialize a tTri to a specified mempool.
- /*!
- @param osc A pointer to the tTri to be initialized.
- @param pool A pointer to the tMempool to which the tTri should be initialized.
- */
void tTri_initToPool (tTri* const osc, tMempool* const pool);
-
-
- //! Free a tTri from the default LEAF mempool.
- /*!
- @param osc A pointer to the tTri to be freed.
- */
void tTri_free (tTri* const osc);
-
- //! Tick a tTri oscillator.
- /*!
- @param osc A pointer to the relevant tTri.
- @return The ticked sample as a float from -1 to 1.
- */
float tTri_tick (tTri* const osc);
-
-
- //! Set the frequency of a tTri oscillator.
- /*!
- @param osc A pointer to the relevant tTriangle.
- @param freq The frequency to set the oscillator to.
- */
void tTri_setFreq (tTri* const osc, float freq);
-
void tTri_setSkew (tTri* const osc, float skew);
/*! @} */
@@ -389,7 +327,6 @@
//==============================================================================
- /* tPulse: Anti-aliased Square waveform. */
typedef struct _tPulse
{
tMempool mempool;
@@ -400,57 +337,16 @@
typedef _tPulse* tPulse;
- /*!
- * @defgroup tPulse tPulse
- * @ingroup oscillators
- * @brief An anti-aliased pulse waveform oscillator with changeable pulse width.
- * @{
- */
-
- //! Initialize a tPulse to the default LEAF mempool.
- /*!
- @param osc A pointer to the tPulse to be initialized.
- */
void tPulse_init (tPulse* const osc);
-
-
- //! Initialize a tPulse to a specified mempool.
- /*!
- @param osc A pointer to the tPulse to be initialized.
- @param pool A pointer to the tMempool to which the tPulse should be initialized.
- */
void tPulse_initToPool (tPulse* const osc, tMempool* const);
-
-
- //! Free a tPulse from the default LEAF mempool.
- /*!
- @param osc A pointer to the tPulse to be freed.
- */
void tPulse_free (tPulse* const osc);
-
- //! Tick a tPulse oscillator.
- /*!
- @param osc A pointer to the relevant tPulse.
- @return The ticked sample as a float from -1 to 1.
- */
float tPulse_tick (tPulse* const osc);
-
-
- //! Set the frequency of a tPulse oscillator.
- /*!
- @param osc A pointer to the relevant tPulse.
- @param freq The frequency to set the oscillator to.
- */
void tPulse_setFreq (tPulse* const osc, float freq);
-
void tPulse_setWidth (tPulse* const osc, float width);
- /*! @} */
-
//==============================================================================
- /* tSawtooth: Anti-aliased Sawtooth waveform. */
typedef struct _tSaw
{
tMempool mempool;
@@ -460,55 +356,15 @@
typedef _tSaw* tSaw;
- /*!
- * @defgroup tsaw tSaw
- * @ingroup oscillators
- * @brief An anti-aliased sawtooth waveform oscillator. Uses wavetable synthesis.
- * @{
- */
-
- //! Initialize a tSaw to the default LEAF mempool.
- /*!
- @param osc A pointer to the tSaw to be initialized.
- */
void tSaw_init (tSaw* const osc);
-
-
- //! Initialize a tSaw to a specified mempool.
- /*!
- @param osc A pointer to the tSaw to be initialized.
- @param pool A pointer to the tMempool to which the tSaw should be initialized.
- */
void tSaw_initToPool (tSaw* const osc, tMempool* const pool);
-
-
- //! Free a tSaw from the default LEAF mempool.
- /*!
- @param osc A pointer to the tSaw to be freed.
- */
void tSaw_free (tSaw* const osc);
-
- //! Tick a tSaw oscillator.
- /*!
- @param osc A pointer to the relevant tSaw.
- @return The ticked sample as a float from -1 to 1.
- */
float tSaw_tick (tSaw* const osc);
-
-
- //! Set the frequency of a tSaw oscillator.
- /*!
- @param osc A pointer to the relevant tSaw.
- @param freq The frequency to set the oscillator to.
- */
void tSaw_setFreq (tSaw* const osc, float freq);
- /*! @} */
-
//==============================================================================
- /* tPhasor: Aliasing phasor [0.0, 1.0) */
typedef struct _tPhasor
{
tMempool mempool;
@@ -519,61 +375,15 @@
typedef _tPhasor* tPhasor;
- /*!
- * @defgroup tphasor Phasor
- * @ingroup oscillators
- * @brief An aliasing phasor.
- * @{
- */
-
- //! Initialize a tPhasor to the default LEAF mempool.
- /*!
- @param osc A pointer to the tPhasor to be initialized.
- */
void tPhasor_init (tPhasor* const osc);
-
-
- //! Initialize a tPhasor to a specified mempool.
- /*!
- @param osc A pointer to the tPhasor to be initialized.
- @param pool A pointer to the tMempool to which the tPhasor should be initialized.
- */
void tPhasor_initToPool (tPhasor* const osc, tMempool* const);
-
-
- //! Free a tPhasor from the default LEAF mempool.
- /*!
- @param osc A pointer to the tPhasor to be freed.
- */
void tPhasor_free (tPhasor* const osc);
-
- //! Tick a tPhasor oscillator.
- /*!
- @param osc A pointer to the relevant tPhasor.
- @return The ticked sample as a float from 0 to 1.
- */
float tPhasor_tick (tPhasor* const osc);
-
-
- //! Set the frequency of a tPhasor oscillator.
- /*!
- @param osc A pointer to the relevant tPhasor.
- @param freq The frequency to set the oscillator to.
- */
void tPhasor_setFreq (tPhasor* const osc, float freq);
- /*! @} */
-
//==============================================================================
- /*!
- * @defgroup tnoise tNoise
- * @ingroup oscillators
- * @brief A noise generator.
- * @{
- */
-
/* tNoise. WhiteNoise, PinkNoise. */
/*!
* Noise types
@@ -596,198 +406,179 @@
} _tNoise;
typedef _tNoise* tNoise;
-
- //! Initialize a tNoise to the default LEAF mempool.
- /*!
- @param osc A pointer to the tNoise to be initialized.
- */
+
void tNoise_init (tNoise* const noise, NoiseType type);
-
-
- //! Initialize a tNoise to a specified mempool.
- /*!
- @param osc A pointer to the tNoise to be initialized.
- @param pool A pointer to the tMempool to which the tNoise should be initialized.
- */
void tNoise_initToPool (tNoise* const noise, NoiseType type, tMempool* const);
-
-
- //! Free a tNoise from the default LEAF mempool.
- /*!
- @param osc A pointer to the tNoise to be freed.
- */
void tNoise_free (tNoise* const noise);
-
- //! Tick a tNoise oscillator.
- /*!
- @param osc A pointer to the relevant tNoise.
- @return The ticked sample as a float from -1 to 1.
- */
float tNoise_tick (tNoise* const noise);
- /*! @} */
-
//==============================================================================
/*!
- * @defgroup tneuron tNeuron
- * @ingroup oscillators
- * @brief A model of a neuron, adapted to act as an oscillator.
- * @{
+ @defgroup tneuron tNeuron
+ @ingroup oscillators
+ @brief A model of a neuron, adapted to act as an oscillator.
+ @{
*/
/*!
- * Neuron modes
- */
- enum NeuronMode
- {
- NeuronNormal, //!< Normal operation
- NeuronTanh, //!< Tanh voltage shaping
- NeuronAaltoShaper, //!< Aalto voltage shaping
- NeuronModeNil
- };
- typedef enum NeuronMode NeuronMode;
-
- typedef struct _tNeuron
- {
- tMempool mempool;
-
- tPoleZero f;
-
- NeuronMode mode;
-
- float voltage, current;
- float timeStep;
-
- float alpha[3];
- float beta[3];
- float rate[3];
- float V[3];
- float P[3];
- float gK, gN, gL, C;
- } _tNeuron;
-
- typedef _tNeuron* tNeuron;
-
- //! Initialize a tNeuron to the default LEAF mempool.
- /*!
+ @fn void tNeuron_init (tNeuron* const neuron)
+ @brief Initialize a tNeuron to the default LEAF mempool.
@param neuron A pointer to the tNeuron to be initialized.
*/
- void tNeuron_init (tNeuron* const neuron);
-
- //! Initialize a tNeuron to a specified mempool.
/*!
+ @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool)
+ @brief Initialize a tNeuron to a specified mempool.
@param neuron A pointer to the tNeuron to be initialized.
@param pool A pointer to the tMempool to which the tNeuron should be initialized.
*/
- void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool);
-
- //! Free a tNeuron from the default LEAF mempool.
/*!
+ @fn void tNeuron_free (tNeuron* const neuron)
+ @brief Free a tNeuron from the default LEAF mempool.
@param neuron A pointer to the tNeuron to be freed.
*/
- void tNeuron_free (tNeuron* const neuron);
-
- //! Reset the neuron model.
/*!
+ @fn void tNeuron_reset (tNeuron* const neuron)
+ @brief Reset the neuron model.
@param neuron A pointer to the relevant tNeuron.
*/
- void tNeuron_reset (tNeuron* const neuron);
-
- //! Tick a tNeuron oscillator.
/*!
+ @fn float tNeuron_tick (tNeuron* const neuron)
+ @brief Tick a tNeuron oscillator.
@param neuron A pointer to the relevant tNeuron.
@return The ticked sample as a float from -1 to 1.
*/
- float tNeuron_tick (tNeuron* const neuron);
-
-
- //! Set the tNeuron shaping mode.
+
/*!
+ @fn void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode)
+ @brief Set the tNeuron shaping mode.
@param neuron A pointer to the relevant tNeuron.
@param mode The mode to set the tNeuron to.
*/
- void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode);
-
-
- //! Set the current.
+
/*!
+ @fn void tNeuron_setCurrent (tNeuron* const neuron, float current)
+ @brief Set the current.
@param neuron A pointer to the relevant tNeuron.
@param current The new current.
*/
- void tNeuron_setCurrent (tNeuron* const neuron, float current);
-
- //! Set the potassium value.
/*!
+ @fn void tNeuron_setK (tNeuron* const neuron, float K)
+ @brief Set the potassium value.
@param neuron A pointer to the relevant tNeuron.
@param K The new potassium.
*/
- void tNeuron_setK (tNeuron* const neuron, float K);
-
- //! Set the chloride value.
/*!
+ @fn void tNeuron_setL (tNeuron* const neuron, float L)
+ @brief Set the chloride value.
@param neuron A pointer to the relevant tNeuron.
@param L The new chloride value.
*/
- void tNeuron_setL (tNeuron* const neuron, float L);
-
- //! Set the sodium value.
/*!
+ @fn void tNeuron_setN (tNeuron* const neuron, float N)
+ @brief Set the sodium value.
@param neuron A pointer to the relevant tNeuron.
@param N The new sodium value.
*/
- void tNeuron_setN (tNeuron* const neuron, float N);
-
- //! Set the calcium value.
/*!
+ @fn void tNeuron_setC (tNeuron* const neuron, float C)
+ @brief Set the calcium value.
@param neuron A pointer to the relevant tNeuron.
@param C The new calcium.
*/
- void tNeuron_setC (tNeuron* const neuron, float C);
-
- //! Set the V1 value.
/*!
+ @fn void tNeuron_setV1 (tNeuron* const neuron, float V1)
+ @brief Set the V1 value.
@param neuron A pointer to the relevant tNeuron.
@param V1 The new V1.
*/
- void tNeuron_setV1 (tNeuron* const neuron, float V1);
-
- //! Set the V2 value.
/*!
+ @fn void tNeuron_setV2 (tNeuron* const neuron, float V2)
+ @brief Set the V2 value.
@param neuron A pointer to the relevant tNeuron.
@param V2 The new V2.
*/
- void tNeuron_setV2 (tNeuron* const neuron, float V2);
-
- //! Set the V3 value.
/*!
+ @fn void tNeuron_setV3 (tNeuron* const neuron, float V3)
+ @brief Set the V3 value.
@param neuron A pointer to the relevant tNeuron.
@param V3 The new V3.
*/
- void tNeuron_setV3 (tNeuron* const neuron, float V3);
-
- //! Set the time step.
/*!
+ @fn void tNeuron_setTimeStep (tNeuron* const neuron, float timestep)
+ @brief Set the time step of the model.
@param neuron A pointer to the relevant tNeuron.
- @param timestep The new time step
+ @param timestep The new time step.
*/
- void tNeuron_setTimeStep (tNeuron* const neuron, float timestep);
+ /*!
+ @brief Shaping modes for tNeuron output.
+ */
+ enum NeuronMode
+ {
+ NeuronNormal, //!< Normal operation
+ NeuronTanh, //!< Tanh voltage shaping
+ NeuronAaltoShaper, //!< Aalto voltage shaping
+ NeuronModeNil
+ };
+
/*! @} */
+ typedef enum NeuronMode NeuronMode;
+
+ typedef struct _tNeuron
+ {
+ tMempool mempool;
+
+ tPoleZero f;
+
+ NeuronMode mode;
+
+ float voltage, current;
+ float timeStep;
+
+ float alpha[3];
+ float beta[3];
+ float rate[3];
+ float V[3];
+ float P[3];
+ float gK, gN, gL, C;
+ } _tNeuron;
+
+ typedef _tNeuron* tNeuron;
+
+ void tNeuron_init (tNeuron* const neuron);
+ void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool);
+ void tNeuron_free (tNeuron* const neuron);
+
+ void tNeuron_reset (tNeuron* const neuron);
+ float tNeuron_tick (tNeuron* const neuron);
+ void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode);
+ void tNeuron_setCurrent (tNeuron* const neuron, float current);
+ void tNeuron_setK (tNeuron* const neuron, float K);
+ void tNeuron_setL (tNeuron* const neuron, float L);
+ void tNeuron_setN (tNeuron* const neuron, float N);
+ void tNeuron_setC (tNeuron* const neuron, float C);
+ void tNeuron_setV1 (tNeuron* const neuron, float V1);
+ void tNeuron_setV2 (tNeuron* const neuron, float V2);
+ void tNeuron_setV3 (tNeuron* const neuron, float V3);
+ void tNeuron_setTimeStep (tNeuron* const neuron, float timestep);
+
+
+
//==============================================================================
#define FILLEN 256
@@ -887,4 +678,6 @@
#endif // LEAF_OSCILLATORS_H_INCLUDED
//==============================================================================
+
+