Unified · Split
| @@ -37,7 +37,7 @@ tPitchDetector detector; · 36 unmodified lines | |||
| 37 | 37 | ||
| 38 | tPeriodDetection pd; | 38 | tPeriodDetection pd; |
| 39 | 39 | ||
| 40 | tZeroCrossing zc; | 40 | tZeroCrossingCounter zc; |
| 41 | tEnvelopeFollower ef; | 41 | tEnvelopeFollower ef; |
| 42 | 42 | ||
| 43 | float gain; | 43 | float gain; |
| @@ -69,7 +69,7 @@ void LEAFTest_init (float sampleRate, int blockSize) · 25 unmodified lines | |||
| 69 | 69 | ||
| 70 | tPeriodDetection_init(&pd, bufIn, bufOut, 4096, 1024); | 70 | tPeriodDetection_init(&pd, bufIn, bufOut, 4096, 1024); |
| 71 | 71 | ||
| 72 | tZeroCrossing_init(&zc, 128); | 72 | tZeroCrossingCounter_init(&zc, 128); |
| 73 | tEnvelopeFollower_init(&ef, 0.02f, 0.9999f); | 73 | tEnvelopeFollower_init(&ef, 0.02f, 0.9999f); |
| 74 | } | 74 | } |
| 75 | 75 | ||
| @@ -107,7 +107,7 @@ float LEAFTest_tick (float input) · 31 unmodified lines | |||
| 107 | freq = altFreq; | 107 | freq = altFreq; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | if (tZeroCrossing_tick(&zc, input) < 0.05 && freq > 0.0f) | 110 | if (tZeroCrossingCounter_tick(&zc, input) < 0.05 && freq > 0.0f) |
| 111 | { | 111 | { |
| 112 | tMBTriangle_setFreq(&btri, freq); | 112 | tMBTriangle_setFreq(&btri, freq); |
| 113 | } | 113 | } |
| @@ -35,32 +35,40 @@ extern "C" { · 34 unmodified lines | |||
| 35 | /*! | 35 | /*! |
| 36 | @defgroup tenvelopefollower tEnvelopeFollower | 36 | @defgroup tenvelopefollower tEnvelopeFollower |
| 37 | @ingroup analysis | 37 | @ingroup analysis |
| 38 | @brief | 38 | @brief Detects and returns the basic envelope of incoming audio data. |
| 39 | @{ | 39 | @{ |
| 40 | 40 | ||
| 41 | @fn void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff) | 41 | @fn void tEnvelopeFollower_init (tEnvelopeFollower* const follower, float attackThreshold, float decayCoeff) |
| 42 | @brief | 42 | @brief Initialize a tEnvelopeFollower to the default LEAF mempool. |
| 43 | @param | 43 | @param follower A pointer to the tEnvelopeFollower to be initialized. |
| 44 | 44 | @param attackThreshold Amplitude threshold for determining an envelope onset. 0.0 to 1.0 | |
| 45 | @fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const) | 45 | @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended. |
| 46 | @brief | 46 | |
| 47 | @param | 47 | @fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const follower, float attackThreshold, float decayCoeff, tMempool* const mempool) |
| 48 | 48 | @brief Initialize a tEnvelopeFollower to a specified mempool. | |
| 49 | @fn void tEnvelopeFollower_free (tEnvelopeFollower* const) | 49 | @param follower A pointer to the tEnvelopeFollower to be initialized. |
| 50 | @brief | 50 | @param attackThreshold Amplitude threshold for determining an envelope onset. 0.0 to 1.0 |
| 51 | @param | 51 | @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended. |
| 52 | 52 | @param mempool A pointer to the tMempool to which the tEnvelopeFollower should be initialized. | |
| 53 | @fn float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x) | 53 | |
| 54 | @brief | 54 | @fn void tEnvelopeFollower_free (tEnvelopeFollower* const follower) |
| 55 | @param | 55 | @brief Free a tEnvelopeFollower from its mempool. |
| 56 | 56 | @param follower A pointer to the tEnvelopeFollower to be freed. | |
| 57 | @fn int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff) | 57 | |
| 58 | @brief | 58 | @fn float tEnvelopeFollower_tick (tEnvelopeFollower* const follower, float input) |
| 59 | @param | 59 | @brief Tick the tEnvelopeFollower. |
| 60 | 60 | @param follower A pointer to the relevant tEnvelopeFollower. | |
| 61 | @fn int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh) | 61 | @param input The input sample. |
| 62 | @brief | 62 | @return The envelope value. |
| 63 | @param | 63 | |
| 64 | @fn void tEnvelopeFollower_setDecayCoefficient (tEnvelopeFollower* const follower, float decayCoeff) | ||
| 65 | @brief Set the envelope decay coefficient. | ||
| 66 | @param follower A pointer to the relevant tEnvelopeFollower. | ||
| 67 | @param decayCoefficient Multiplier to determine the envelope rate of decay. 0.0 to 1.0, above 0.95 recommended. | ||
| 68 | |||
| 69 | @fn void tEnvelopeFollower_setAttackThreshold (tEnvelopeFollower* const follower, float attackThresh) | ||
| 70 | @brief Set the envelope attack threshold. | ||
| 71 | @param follower A pointer to the relevant tEnvelopeFollower. | ||
| 64 |  | 72 |  |
| 65 | @} */ | 73 | @} */ |
| 66 | 74 | ||
| @@ -75,46 +83,50 @@ extern "C" { · 8 unmodified lines | |||
| 75 | 83 | ||
| 76 | typedef _tEnvelopeFollower* tEnvelopeFollower; | 84 | typedef _tEnvelopeFollower* tEnvelopeFollower; |
| 77 | 85 | ||
| 78 | void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff); | 86 | void tEnvelopeFollower_init (tEnvelopeFollower* const follower, float attackThreshold, float decayCoefficient); |
| 79 | void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const); | 87 | void tEnvelopeFollower_initToPool (tEnvelopeFollower* const follower, float attackThreshold, float decayCoefficient, tMempool* const mempool); |
| 80 | void tEnvelopeFollower_free (tEnvelopeFollower* const); | 88 | void tEnvelopeFollower_free (tEnvelopeFollower* const follower); |
| 81 | |||
| 82 | float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x); | ||
| 83 | int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff); | ||
| 84 | int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh); | ||
| 85 | 89 | ||
| 86 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 90 | float tEnvelopeFollower_tick (tEnvelopeFollower* const follower, float sample); |
| 91 | void tEnvelopeFollower_setDecayCoefficient (tEnvelopeFollower* const follower, float decayCoefficient); | ||
| 92 | void tEnvelopeFollower_setAttackThreshold (tEnvelopeFollower* const follower, float attackThreshold); | ||
| 87 | 93 | ||
| 88 | /*! | 94 | /*! |
| 89 | @defgroup tzerocrossing tZeroCrossing | 95 | @defgroup tzerocrossingcounter tZeroCrossingCounter |
| 90 | @ingroup analysis | 96 | @ingroup analysis |
| 91 | @brief | 97 | @brief Counts the amount of zero crossings within a window of the input audio data |
| 92 | @{ | 98 | @{ |
| 93 | 99 | ||
| 94 | @fn void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize) | 100 | @fn void tZeroCrossingCounter_init (tZeroCrossingCounter* const counter, int maxWindowSize) |
| 95 | @brief | 101 | @brief Initialize a tZeroCrossingCounter to the default LEAF mempool. |
| 96 | @param | 102 | @param counter A pointer to the tZeroCrossingCounter to be initialized. |
| 97 | 103 | @param maxWindowSize The max and initial size of the window. | |
| 98 | @fn void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const) | 104 | |
| 99 | @brief | 105 | @fn void tZeroCrossingCounter_initToPool (tZeroCrossingCounter* const counter, int maxWindowSize, tMempool* const mempool) |
| 100 | @param | 106 | @brief Initialize a tZeroCrossingCounter to a specified mempool. |
| 101 | 107 | @param counter A pointer to the tZeroCrossingCounter to be initialized. | |
| 102 | @fn void tZeroCrossing_free (tZeroCrossing* const) | 108 | @param maxWindowSize The max and initial size of the window. |
| 103 | @brief | 109 | @param mempool A pointer to the tMempool to which the tZeroCrossingCounter should be initialized. |
| 104 | @param | 110 | |
| 105 | 111 | @fn void tZeroCrossingCounter_free (tZeroCrossingCounter* const counter) | |
| 106 | @fn float tZeroCrossing_tick (tZeroCrossing* const, float input) | 112 | @brief Free a tZeroCrossingCounter from its mempool. |
| 107 | @brief | 113 | @param counter A pointer to the tZeroCrossingCounter to be freed. |
| 108 | @param | 114 | |
| 109 | 115 | @fn float tZeroCrossingCounter_tick (tZeroCrossingCounter* const counter, float input) | |
| 110 | @fn void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize) | 116 | @brief Tick the tZeroCrossingCounter. |
| 111 | @brief | 117 | @param counter A pointer to the relevant tZeroCrossingCounter. |
| 112 | @param | 118 | @param input The input sample. |
| 119 | @return The amount of zero crossings as a proportion of the window. | ||
| 120 | |||
| 121 | @fn void tZeroCrossingCounter_setWindowSize (tZeroCrossingCounter* const counter, float windowSize) | ||
| 122 | @brief Set the size of the window. Cannot be greater than the max size given on initialization. | ||
| 123 | @param counter A pointer to the relevant tZeroCrossingCounter. | ||
| 124 | @param windowSize The new window size. | ||
| 113 |  | 125 |  |
| 114 | @} */ | 126 | @} */ |
| 115 | 127 | ||
| 116 | /* Zero Crossing Detector */ | 128 | /* Zero Crossing Detector */ |
| 117 | typedef struct _tZeroCrossing { | 129 | typedef struct _tZeroCrossingCounter { |
| 118 | tMempool mempool; | 130 | tMempool mempool; |
| 119 | int count; | 131 | int count; |
| 120 | int maxWindowSize; | 132 | int maxWindowSize; |
| @@ -124,16 +136,16 @@ extern "C" { · 3 unmodified lines | |||
| 124 | uint16_t* countBuffer; | 136 | uint16_t* countBuffer; |
| 125 | int prevPosition; | 137 | int prevPosition; |
| 126 | int position; | 138 | int position; |
| 127 | } _tZeroCrossing; | 139 | } _tZeroCrossingCounter; |
| 128 | 140 | ||
| 129 | typedef _tZeroCrossing* tZeroCrossing; | 141 | typedef _tZeroCrossingCounter* tZeroCrossingCounter; |
| 130 | 142 | ||
| 131 | void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize); | 143 | void tZeroCrossingCounter_init (tZeroCrossingCounter* const, int maxWindowSize); |
| 132 | void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const); | 144 | void tZeroCrossingCounter_initToPool (tZeroCrossingCounter* const, int maxWindowSize, tMempool* const mempool); |
| 133 | void tZeroCrossing_free (tZeroCrossing* const); | 145 | void tZeroCrossingCounter_free (tZeroCrossingCounter* const); |
| 134 | 146 | ||
| 135 | float tZeroCrossing_tick (tZeroCrossing* const, float input); | 147 | float tZeroCrossingCounter_tick (tZeroCrossingCounter* const, float input); |
| 136 | void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize); | 148 | void tZeroCrossingCounter_setWindowSize (tZeroCrossingCounter* const, float windowSize); |
| 137 | 149 | ||
| 138 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 150 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 139 | 151 | ||
| @@ -144,11 +156,11 @@ extern "C" { · 4 unmodified lines | |||
| 144 | @{ | 156 | @{ |
| 145 | 157 | ||
| 146 | @fn void tPowerFollower_init (tPowerFollower* const, float factor) | 158 | @fn void tPowerFollower_init (tPowerFollower* const, float factor) |
| 147 | @brief | 159 | @brief Initialize a tPowerFollower to the default LEAF mempool. |
| 148 | @param | 160 | @param |
| 149 | 161 | ||
| 150 | @fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const) | 162 | @fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const) |
| 151 | @brief | 163 | @brief Initialize a tPowerFollower to a specified mempool. |
| 152 | @param | 164 | @param |
| 153 | 165 | ||
| 154 | @fn void tPowerFollower_free (tPowerFollower* const) | 166 | @fn void tPowerFollower_free (tPowerFollower* const) |
| @@ -193,15 +205,15 @@ extern "C" { · 38 unmodified lines | |||
| 193 | /*! | 205 | /*! |
| 194 | @defgroup tenvpd tEnvPD | 206 | @defgroup tenvpd tEnvPD |
| 195 | @ingroup analysis | 207 | @ingroup analysis |
| 196 | @brief | 208 | @brief ENV~ from PD, modified for LEAF |
| 197 | @{ | 209 | @{ |
| 198 | 210 | ||
| 199 | @fn void tEnvPD_init (tEnvPD* const, int windowSize, int hopSize, int blockSize) | 211 | @fn void tEnvPD_init (tEnvPD* const, int windowSize, int hopSize, int blockSize) |
| 200 | @brief | 212 | @brief Initialize a tEnvPD to the default LEAF mempool. |
| 201 | @param | 213 | @param |
| 202 | 214 | ||
| 203 | @fn void tEnvPD_initToPool (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const) | 215 | @fn void tEnvPD_initToPool (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const) |
| 204 | @brief | 216 | @brief Initialize a tEnvPD to a specified mempool. |
| 205 | @param | 217 | @param |
| 206 | 218 | ||
| 207 | @fn void tEnvPD_free (tEnvPD* const) | 219 | @fn void tEnvPD_free (tEnvPD* const) |
| @@ -218,7 +230,6 @@ extern "C" { · 10 unmodified lines | |||
| 218 |  | 230 |  |
| 219 | @} */ | 231 | @} */ |
| 220 | 232 | ||
| 221 | // ENV~ from PD, modified for LEAF | ||
| 222 | #define MAXOVERLAP 32 | 233 | #define MAXOVERLAP 32 |
| 223 | #define INITVSTAKEN 64 | 234 | #define INITVSTAKEN 64 |
| 224 | #define ENV_WINDOW_SIZE 1024 | 235 | #define ENV_WINDOW_SIZE 1024 |
| @@ -257,11 +268,11 @@ extern "C" { · 32 unmodified lines | |||
| 257 | @{ | 268 | @{ |
| 258 | 269 | ||
| 259 | @fn void tAttackDetection_init (tAttackDetection* const, int blocksize, int atk, int rel) | 270 | @fn void tAttackDetection_init (tAttackDetection* const, int blocksize, int atk, int rel) |
| 260 | @brief | 271 | @brief Initialize a tAttackDetection to the default LEAF mempool. |
| 261 | @param | 272 | @param |
| 262 | 273 | ||
| 263 | @fn void tAttackDetection_initToPool (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const) | 274 | @fn void tAttackDetection_initToPool (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const) |
| 264 | @brief | 275 | @brief Initialize a tAttackDetection to a specified mempool. |
| 265 | @param | 276 | @param |
| 266 | 277 | ||
| 267 | @fn void tAttackDetection_free (tAttackDetection* const) | 278 | @fn void tAttackDetection_free (tAttackDetection* const) |
| @@ -344,11 +355,11 @@ extern "C" { · 76 unmodified lines | |||
| 344 | @{ | 355 | @{ |
| 345 | 356 | ||
| 346 | @fn void tSNAC_init (tSNAC* const, int overlaparg) | 357 | @fn void tSNAC_init (tSNAC* const, int overlaparg) |
| 347 | @brief | 358 | @brief Initialize a tSNAC to the default LEAF mempool. |
| 348 | @param | 359 | @param |
| 349 | 360 | ||
| 350 | @fn void tSNAC_initToPool (tSNAC* const, int overlaparg, tMempool* const) | 361 | @fn void tSNAC_initToPool (tSNAC* const, int overlaparg, tMempool* const) |
| 351 | @brief | 362 | @brief Initialize a tSNAC to a specified mempool. |
| 352 | @param | 363 | @param |
| 353 | 364 | ||
| 354 | @fn void tSNAC_free (tSNAC* const) | 365 | @fn void tSNAC_free (tSNAC* const) |
| @@ -433,11 +444,11 @@ extern "C" { · 78 unmodified lines | |||
| 433 | 444 | ||
| 434 | /*! | 445 | /*! |
| 435 | @fn void tPeriodDetection_init (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize) | 446 | @fn void tPeriodDetection_init (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize) |
| 436 | @brief | 447 | @brief Initialize a tPeriodDetection to the default LEAF mempool. |
| 437 | @param | 448 | @param |
| 438 | 449 | ||
| 439 | @fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const) | 450 | @fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const) |
| 440 | @brief | 451 | @brief Initialize a tPeriodDetection to a specified mempool. |
| 441 | @param | 452 | @param |
| 442 | 453 | ||
| 443 | @fn void tPeriodDetection_free (tPeriodDetection* const) | 454 | @fn void tPeriodDetection_free (tPeriodDetection* const) |
| @@ -664,11 +675,11 @@ extern "C" { · 220 unmodified lines | |||
| 664 | @{ | 675 | @{ |
| 665 | 676 | ||
| 666 | @fn void tPeriodDetector_init (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis) | 677 | @fn void tPeriodDetector_init (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis) |
| 667 | @brief | 678 | @brief Initialize a tPeriodDetector to the default LEAF mempool. |
| 668 | @param | 679 | @param |
| 669 | 680 | ||
| 670 | @fn void tPeriodDetector_initToPool (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool) | 681 | @fn void tPeriodDetector_initToPool (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool) |
| 671 | @brief | 682 | @brief Initialize a tPeriodDetector to a specified mempool. |
| 672 | @param | 683 | @param |
| 673 | 684 | ||
| 674 | @fn void tPeriodDetector_free (tPeriodDetector* const detector) | 685 | @fn void tPeriodDetector_free (tPeriodDetector* const detector) |
| @@ -774,11 +785,11 @@ extern "C" { · 99 unmodified lines | |||
| 774 | @{ | 785 | @{ |
| 775 | 786 | ||
| 776 | @fn void tPitchDetector_init (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis) | 787 | @fn void tPitchDetector_init (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis) |
| 777 | @brief | 788 | @brief Initialize a tPitchDetector to the default LEAF mempool. |
| 778 | @param | 789 | @param |
| 779 | 790 | ||
| 780 | @fn void tPitchDetector_initToPool (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool) | 791 | @fn void tPitchDetector_initToPool (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool) |
| 781 | @brief | 792 | @brief Initialize a tPitchDetector to a specified mempool. |
| 782 | @param | 793 | @param |
| 783 | 794 | ||
| 784 | @fn void tPitchDetector_free (tPitchDetector* const detector) | 795 | @fn void tPitchDetector_free (tPitchDetector* const detector) |
| @@ -37,7 +37,7 @@ extern "C" { · 36 unmodified lines | |||
| 37 | /*! | 37 | /*! |
| 38 | @defgroup tenvelope tEnvelope | 38 | @defgroup tenvelope tEnvelope |
| 39 | @ingroup envelopes | 39 | @ingroup envelopes |
| 40 | @brief Attack-decay envelope. | 40 | @brief Basic attack-decay envelope. |
| 41 | @{ | 41 | @{ |
| 42 | 42 | ||
| 43 | @fn void tEnvelope_init (tEnvelope* const, float attack, float decay, int loop) | 43 | @fn void tEnvelope_init (tEnvelope* const, float attack, float decay, int loop) |
| @@ -96,7 +96,7 @@ extern "C" { · 95 unmodified lines | |||
| 96 | void tMempool_init (tMempool* const pool, char* memory, size_t size); | 96 | void tMempool_init (tMempool* const pool, char* memory, size_t size); |
| 97 | 97 | ||
| 98 | 98 | ||
| 99 | //! Free a tMempool from the default LEAF mempool. | 99 | //! Free a tMempool from its mempool. |
| 100 | /*! | 100 | /*! |
| 101 | @param pool A pointer to the tMempool to be freed. | 101 | @param pool A pointer to the tMempool to be freed. |
| 102 | */ | 102 | */ |
| @@ -115,7 +115,7 @@ extern "C" { · 12 unmodified lines | |||
| 115 | 115 | ||
| 116 | //! Free a tMempool from a specified mempool. | 116 | //! Free a tMempool from a specified mempool. |
| 117 | /*! | 117 | /*! |
| 118 | @param pool A pointer to the tMempool to be freed from the default LEAF mempool. | 118 | @param pool A pointer to the tMempool to be freed from its mempool. |
| 119 | @param poolFrom A pointer to the tMempool from which a tMempool should be freed. | 119 | @param poolFrom A pointer to the tMempool from which a tMempool should be freed. |
| 120 | */ | 120 | */ |
| 121 | void tMempool_freeFromPool (tMempool* const pool, tMempool* const poolFrom); | 121 | void tMempool_freeFromPool (tMempool* const pool, tMempool* const poolFrom); |
| @@ -48,7 +48,7 @@ extern "C" { · 47 unmodified lines | |||
| 48 | @param mempool A pointer to the tMempool to which the tStack should be initialized. | 48 | @param mempool A pointer to the tMempool to which the tStack should be initialized. |
| 49 | 49 | ||
| 50 | @fn void tStack_free (tStack* const stack) | 50 | @fn void tStack_free (tStack* const stack) |
| 51 | @brief Free a tStack from the default LEAF mempool. | 51 | @brief Free a tStack from its mempool. |
| 52 | @param stack A pointer to the tStack to be freed. | 52 | @param stack A pointer to the tStack to be freed. |
| 53 | 53 | ||
| 54 | @fn void tStack_setCapacity (tStack* const stack, uint16_t cap) | 54 | @fn void tStack_setCapacity (tStack* const stack, uint16_t cap) |
| @@ -149,7 +149,7 @@ extern "C" { · 94 unmodified lines | |||
| 149 | @param pool A pointer to the tMempool to which the tPoly should be initialized. | 149 | @param pool A pointer to the tMempool to which the tPoly should be initialized. |
| 150 | 150 | ||
| 151 | @fn void tPoly_free (tPoly* const poly) | 151 | @fn void tPoly_free (tPoly* const poly) |
| 152 | @brief Free a tPoly from the default LEAF mempool. | 152 | @brief Free a tPoly from its mempool. |
| 153 | @param poly A pointer to the tPoly to be freed. | 153 | @param poly A pointer to the tPoly to be freed. |
| 154 | 154 | ||
| 155 | @fn int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel) | 155 | @fn int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel) |
| @@ -315,29 +315,29 @@ extern "C" { · 159 unmodified lines | |||
| 315 | @{ | 315 | @{ |
| 316 | 316 | ||
| 317 | @fn void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices) | 317 | @fn void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices) |
| 318 | @brief Initialize a tPoly to the default LEAF mempool. | 318 | @brief Initialize a tSimplePoly to the default LEAF mempool. |
| 319 | @param poly A pointer to the tPoly to be initialized. | 319 | @param poly A pointer to the tSimplePoly to be initialized. |
| 320 | @param maxNumVoices The maximum number of voices this tPoly can handle at once. | 320 | @param maxNumVoices The maximum number of voices this tSimplePoly can handle at once. |
| 321 | 321 | ||
| 322 | @fn void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool) | 322 | @fn void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool) |
| 323 | @brief Initialize a tPoly to a specified mempool. | 323 | @brief Initialize a tSimplePoly to a specified mempool. |
| 324 | @param poly A pointer to the tPoly to be initialized. | 324 | @param poly A pointer to the tSimplePoly to be initialized. |
| 325 | @param pool A pointer to the tMempool to which the tPoly should be initialized. | 325 | @param pool A pointer to the tMempool to which the tSimplePoly should be initialized. |
| 326 | 326 | ||
| 327 | @fn void tSimplePoly_free (tSimplePoly* const poly) | 327 | @fn void tSimplePoly_free (tSimplePoly* const poly) |
| 328 | @brief Free a tPoly from the default LEAF mempool. | 328 | @brief Free a tSimplePoly from its mempool. |
| 329 | @param poly A pointer to the tPoly to be freed. | 329 | @param poly A pointer to the tSimplePoly to be freed. |
| 330 | 330 | ||
| 331 | @fn int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel) | 331 | @fn int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel) |
| 332 | @brief Add a note with a given velocity to the poly handler. | 332 | @brief Add a note with a given velocity to the poly handler. |
| 333 | @param poly A pointer to the relevant tPoly. | 333 | @param poly A pointer to the relevant tSimplePoly. |
| 334 | @param note The MIDI note number to add. | 334 | @param note The MIDI note number to add. |
| 335 | @param vel The MIDI velocity of the note to add. | 335 | @param vel The MIDI velocity of the note to add. |
| 336 | @return The voice that will play the note. | 336 | @return The voice that will play the note. |
| 337 | 337 | ||
| 338 | @fn int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note) | 338 | @fn int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note) |
| 339 | @brief Remove a note from the poly handler. | 339 | @brief Remove a note from the poly handler. |
| 340 | @param poly A pointer to the relevant tPoly. | 340 | @param poly A pointer to the relevant tSimplePoly. |
| 341 | @param note The MIDI note number to remove. | 341 | @param note The MIDI note number to remove. |
| 342 | @return The voice that was playing the removed note. | 342 | @return The voice that was playing the removed note. |
| 343 | 343 | ||
| @@ -355,22 +355,22 @@ extern "C" { · 11 unmodified lines | |||
| 355 | 355 | ||
| 356 | @fn void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices) | 356 | @fn void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices) |
| 357 | @brief Set the number of voices available to play notes. | 357 | @brief Set the number of voices available to play notes. |
| 358 | @param poly A pointer to the relevant tPoly. | 358 | @param poly A pointer to the relevant tSimplePoly. |
| 359 | @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init(). | 359 | @param numVoices The new number of available voices. Cannot be greater than the max number voices given on initialization. |
| 360 | 360 | ||
| 361 | @fn int tSimplePoly_getNumVoices (tSimplePoly* const poly) | 361 | @fn int tSimplePoly_getNumVoices (tSimplePoly* const poly) |
| 362 | @brief Get the current number of voices available to play notes. | 362 | @brief Get the current number of voices available to play notes. |
| 363 | @param poly A pointer to the relevant tPoly. | 363 | @param poly A pointer to the relevant tSimplePoly. |
| 364 | @return The current number of voices available to play notes. | 364 | @return The current number of voices available to play notes. |
| 365 | 365 | ||
| 366 | @fn int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly) | 366 | @fn int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly) |
| 367 | @brief Get the number of voices currently playing notes. | 367 | @brief Get the number of voices currently playing notes. |
| 368 | @param poly A pointer to the relevant tPoly. | 368 | @param poly A pointer to the relevant tSimplePoly. |
| 369 | @return The number of voices currently playing notes. | 369 | @return The number of voices currently playing notes. |
| 370 | 370 | ||
| 371 | @fn int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice) | 371 | @fn int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice) |
| 372 | @brief Get the current MIDI note number of a given voice. | 372 | @brief Get the current MIDI note number of a given voice. |
| 373 | @param poly A pointer to the relevant tPoly. | 373 | @param poly A pointer to the relevant tSimplePoly. |
| 374 | @param voice The voice to get the MIDI note number of. | 374 | @param voice The voice to get the MIDI note number of. |
| 375 | @return The MIDI note number of the given voice. | 375 | @return The MIDI note number of the given voice. |
| 376 | 376 | ||
| @@ -379,13 +379,13 @@ extern "C" { · 2 unmodified lines | |||
| 379 | 379 | ||
| 380 | @fn int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice) | 380 | @fn int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice) |
| 381 | @brief Get the current MIDI velocity of a given voice. | 381 | @brief Get the current MIDI velocity of a given voice. |
| 382 | @param poly A pointer to the relevant tPoly. | 382 | @param poly A pointer to the relevant tSimplePoly. |
| 383 | @param voice The voice to get the MIDI velocity of. | 383 | @param voice The voice to get the MIDI velocity of. |
| 384 | @return The current MIDI velocity of the given voice. | 384 | @return The current MIDI velocity of the given voice. |
| 385 | 385 | ||
| 386 | @fn int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice) | 386 | @fn int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice) |
| 387 | @brief Get the current play state of a given voice. | 387 | @brief Get the current play state of a given voice. |
| 388 | @param poly A pointer to the relevant tPoly. | 388 | @param poly A pointer to the relevant tSimplePoly. |
| 389 | @param voice The voice to get the state of. | 389 | @param voice The voice to get the state of. |
| 390 | @return The current play state of the given voice. | 390 | @return The current play state of the given voice. |
| 391 | 391 | ||
| @@ -34,17 +34,21 @@ extern "C" { · 33 unmodified lines | |||
| 34 | @brief A general wavetable oscillator. | 34 | @brief A general wavetable oscillator. |
| 35 | @{ | 35 | @{ |
| 36 | 36 | ||
| 37 | @fn void tTable_init (tTable* const osc, float* waveTable, int size) | 37 | @fn void tTable_init (tTable* const osc, float* table, int size) |
| 38 | @brief Initialize a tTable to the default LEAF mempool. | 38 | @brief Initialize a tTable to the default LEAF mempool. |
| 39 | @param osc A pointer to the tTable to be initialized. | 39 | @param osc A pointer to the tTable to be initialized. |
| 40 | @param table A pointer to the wave table data. | ||
| 41 | @param size The number of samples in the wave table. | ||
| 40 | 42 | ||
| 41 | @fn void tTable_initToPool (tTable* const osc, float* waveTable, int size, tMempool* const mempool) | 43 | @fn void tTable_initToPool (tTable* const osc, float* table, int size, tMempool* const mempool) |
| 42 | @brief Initialize a tTable to a specified mempool. | 44 | @brief Initialize a tTable to a specified mempool. |
| 43 | @param osc A pointer to the tTable to be initialized. | 45 | @param osc A pointer to the tTable to be initialized. |
| 44 | @param pool A pointer to the tMempool to which the tTable should be initialized. | 46 | @param table A pointer to the wave table data. |
| 47 | @param size The number of samples in the wave table. | ||
| 48 | @param mempool A pointer to the tMempool to which the tTable should be initialized. | ||
| 45 | 49 | ||
| 46 | @fn void tTable_free (tTable* const osc) | 50 | @fn void tTable_free (tTable* const osc) |
| 47 | @brief Free a tTable from the default LEAF mempool. | 51 | @brief Free a tTable from its mempool. |
| 48 | @param osc A pointer to the tTable to be freed. | 52 | @param osc A pointer to the tTable to be freed. |
| 49 | 53 | ||
| 50 | @fn float tTable_tick (tTable* const osc) | 54 | @fn float tTable_tick (tTable* const osc) |
| @@ -71,8 +75,8 @@ extern "C" { · 20 unmodified lines | |||
| 71 | 75 | ||
| 72 | typedef _tTable* tTable; | 76 | typedef _tTable* tTable; |
| 73 | 77 | ||
| 74 | void tTable_init(tTable* const osc, float* waveTable, int size); | 78 | void tTable_init(tTable* const osc, float* table, int size); |
| 75 | void tTable_initToPool(tTable* const osc, float* waveTable, int size, tMempool* const mempool); | 79 | void tTable_initToPool(tTable* const osc, float* table, int size, tMempool* const mempool); |
| 76 | void tTable_free(tTable* const osc); | 80 | void tTable_free(tTable* const osc); |
| 77 | 81 | ||
| 78 | float tTable_tick(tTable* const osc); | 82 | float tTable_tick(tTable* const osc); |
| @@ -90,13 +94,13 @@ extern "C" { · 11 unmodified lines | |||
| 90 | @brief Initialize a tCycle to the default LEAF mempool. | 94 | @brief Initialize a tCycle to the default LEAF mempool. |
| 91 | @param osc A pointer to the tCycle to be initialized. | 95 | @param osc A pointer to the tCycle to be initialized. |
| 92 | 96 | ||
| 93 | @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool) | 97 | @fn void tCycle_initToPool (tCycle* const osc, tMempool* const mempool) |
| 94 | @brief Initialize a tCycle to a specified mempool. | 98 | @brief Initialize a tCycle to a specified mempool. |
| 95 | @param osc A pointer to the tCycle to be initialized. | 99 | @param osc A pointer to the tCycle to be initialized. |
| 96 | @param pool A pointer to the tMempool to which the tCycle should be initialized. | 100 | @param mempool A pointer to the tMempool to which the tCycle should be initialized. |
| 97 | 101 | ||
| 98 | @fn void tCycle_free (tCycle* const osc) | 102 | @fn void tCycle_free (tCycle* const osc) |
| 99 | @brief Free a tCycle from the default LEAF mempool. | 103 | @brief Free a tCycle from its mempool. |
| 100 | @param osc A pointer to the tCycle to be freed. | 104 | @param osc A pointer to the tCycle to be freed. |
| 101 | 105 | ||
| 102 | @fn float tCycle_tick (tCycle* const osc) | 106 | @fn float tCycle_tick (tCycle* const osc) |
| @@ -123,7 +127,7 @@ extern "C" { · 20 unmodified lines | |||
| 123 | typedef _tCycle* tCycle; | 127 | typedef _tCycle* tCycle; |
| 124 | 128 | ||
| 125 | void tCycle_init (tCycle* const osc); | 129 | void tCycle_init (tCycle* const osc); |
| 126 | void tCycle_initToPool (tCycle* const osc, tMempool* const pool); | 130 | void tCycle_initToPool (tCycle* const osc, tMempool* const mempool); |
| 127 | void tCycle_free (tCycle* const osc); | 131 | void tCycle_free (tCycle* const osc); |
| 128 | 132 | ||
| 129 | float tCycle_tick (tCycle* const osc); | 133 | float tCycle_tick (tCycle* const osc); |
| @@ -141,13 +145,13 @@ extern "C" { · 11 unmodified lines | |||
| 141 | @brief Initialize a tTriangle to the default LEAF mempool. | 145 | @brief Initialize a tTriangle to the default LEAF mempool. |
| 142 | @param osc A pointer to the tTriangle to be initialized. | 146 | @param osc A pointer to the tTriangle to be initialized. |
| 143 | 147 | ||
| 144 | @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool) | 148 | @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const mempool) |
| 145 | @brief Initialize a tTriangle to a specified mempool. | 149 | @brief Initialize a tTriangle to a specified mempool. |
| 146 | @param osc A pointer to the tTriangle to be initialized. | 150 | @param osc A pointer to the tTriangle to be initialized. |
| 147 | @param pool A pointer to the tMempool to which the tTriangle should be initialized. | 151 | @param mempool A pointer to the tMempool to which the tTriangle should be initialized. |
| 148 | 152 | ||
| 149 | @fn void tTriangle_free (tTriangle* const osc) | 153 | @fn void tTriangle_free (tTriangle* const osc) |
| 150 | @brief Free a tTriangle from the default LEAF mempool. | 154 | @brief Free a tTriangle from its mempool. |
| 151 | @param osc A pointer to the tTriangle to be freed. | 155 | @param osc A pointer to the tTriangle to be freed. |
| 152 | 156 | ||
| 153 | @fn float tTriangle_tick (tTriangle* const osc) | 157 | @fn float tTriangle_tick (tTriangle* const osc) |
| @@ -175,7 +179,7 @@ extern "C" { · 21 unmodified lines | |||
| 175 | typedef _tTriangle* tTriangle; | 179 | typedef _tTriangle* tTriangle; |
| 176 | 180 | ||
| 177 | void tTriangle_init (tTriangle* const osc); | 181 | void tTriangle_init (tTriangle* const osc); |
| 178 | void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool); | 182 | void tTriangle_initToPool (tTriangle* const osc, tMempool* const mempool); |
| 179 | void tTriangle_free (tTriangle* const osc); | 183 | void tTriangle_free (tTriangle* const osc); |
| 180 | 184 | ||
| 181 | float tTriangle_tick (tTriangle* const osc); | 185 | float tTriangle_tick (tTriangle* const osc); |
| @@ -194,13 +198,13 @@ extern "C" { · 12 unmodified lines | |||
| 194 | @brief Initialize a tSquare to the default LEAF mempool. | 198 | @brief Initialize a tSquare to the default LEAF mempool. |
| 195 | @param osc A pointer to the tSquare to be initialized. | 199 | @param osc A pointer to the tSquare to be initialized. |
| 196 | 200 | ||
| 197 | @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool) | 201 | @fn void tSquare_initToPool (tSquare* const osc, tMempool* const mempool) |
| 198 | @brief Initialize a tSquare to a specified mempool. | 202 | @brief Initialize a tSquare to a specified mempool. |
| 199 | @param osc A pointer to the tSquare to be initialized. | 203 | @param osc A pointer to the tSquare to be initialized. |
| 200 | @param pool A pointer to the tMempool to which the tSquare should be initialized. | 204 | @param mempool A pointer to the tMempool to which the tSquare should be initialized. |
| 201 | 205 | ||
| 202 | @fn void tSquare_free (tSquare* const osc) | 206 | @fn void tSquare_free (tSquare* const osc) |
| 203 | @brief Free a tSquare from the default LEAF mempool. | 207 | @brief Free a tSquare from its mempool. |
| 204 | @param osc A pointer to the tSquare to be freed. | 208 | @param osc A pointer to the tSquare to be freed. |
| 205 | 209 | ||
| 206 | @fn float tSquare_tick (tSquare* const osc) | 210 | @fn float tSquare_tick (tSquare* const osc) |
| @@ -249,13 +253,13 @@ extern "C" { · 42 unmodified lines | |||
| 249 | @brief Initialize a tSawtooth to the default LEAF mempool. | 253 | @brief Initialize a tSawtooth to the default LEAF mempool. |
| 250 | @param osc A pointer to the tSawtooth to be initialized. | 254 | @param osc A pointer to the tSawtooth to be initialized. |
| 251 | 255 | ||
| 252 | @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool) | 256 | @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const mempool) |
| 253 | @brief Initialize a tSawtooth to a specified mempool. | 257 | @brief Initialize a tSawtooth to a specified mempool. |
| 254 | @param osc A pointer to the tSawtooth to be initialized. | 258 | @param osc A pointer to the tSawtooth to be initialized. |
| 255 | @param pool A pointer to the tMempool to which the tSawtooth should be initialized. | 259 | @param mempool A pointer to the tMempool to which the tSawtooth should be initialized. |
| 256 | 260 | ||
| 257 | @fn void tSawtooth_free (tSawtooth* const osc) | 261 | @fn void tSawtooth_free (tSawtooth* const osc) |
| 258 | @brief Free a tSawtooth from the default LEAF mempool. | 262 | @brief Free a tSawtooth from its mempool. |
| 259 | @param osc A pointer to the tSawtooth to be freed. | 263 | @param osc A pointer to the tSawtooth to be freed. |
| 260 | 264 | ||
| 261 | @fn float tSawtooth_tick (tSawtooth* const osc) | 265 | @fn float tSawtooth_tick (tSawtooth* const osc) |
| @@ -283,7 +287,7 @@ extern "C" { · 21 unmodified lines | |||
| 283 | typedef _tSawtooth* tSawtooth; | 287 | typedef _tSawtooth* tSawtooth; |
| 284 | 288 | ||
| 285 | void tSawtooth_init (tSawtooth* const osc); | 289 | void tSawtooth_init (tSawtooth* const osc); |
| 286 | void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool); | 290 | void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const mempool); |
| 287 | void tSawtooth_free (tSawtooth* const osc); | 291 | void tSawtooth_free (tSawtooth* const osc); |
| 288 | 292 | ||
| 289 | float tSawtooth_tick (tSawtooth* const osc); | 293 | float tSawtooth_tick (tSawtooth* const osc); |
| @@ -301,7 +305,7 @@ extern "C" { · 11 unmodified lines | |||
| 301 | @brief | 305 | @brief |
| 302 | @param | 306 | @param |
| 303 | 307 | ||
| 304 | @fn void tTri_initToPool (tTri* const osc, tMempool* const pool) | 308 | @fn void tTri_initToPool (tTri* const osc, tMempool* const mempool) |
| 305 | @brief | 309 | @brief |
| 306 | @param | 310 | @param |
| 307 | 311 | ||
| @@ -335,7 +339,7 @@ extern "C" { · 27 unmodified lines | |||
| 335 | typedef _tTri* tTri; | 339 | typedef _tTri* tTri; |
| 336 | 340 | ||
| 337 | void tTri_init (tTri* const osc); | 341 | void tTri_init (tTri* const osc); |
| 338 | void tTri_initToPool (tTri* const osc, tMempool* const pool); | 342 | void tTri_initToPool (tTri* const osc, tMempool* const mempool); |
| 339 | void tTri_free (tTri* const osc); | 343 | void tTri_free (tTri* const osc); |
| 340 | 344 | ||
| 341 | float tTri_tick (tTri* const osc); | 345 | float tTri_tick (tTri* const osc); |
| @@ -406,7 +410,7 @@ extern "C" { · 64 unmodified lines | |||
| 406 | @brief | 410 | @brief |
| 407 | @param | 411 | @param |
| 408 | 412 | ||
| 409 | @fn void tSaw_initToPool (tSaw* const osc, tMempool* const pool) | 413 | @fn void tSaw_initToPool (tSaw* const osc, tMempool* const mempool) |
| 410 | @brief | 414 | @brief |
| 411 | @param | 415 | @param |
| 412 | 416 | ||
| @@ -434,7 +438,7 @@ extern "C" { · 21 unmodified lines | |||
| 434 | typedef _tSaw* tSaw; | 438 | typedef _tSaw* tSaw; |
| 435 | 439 | ||
| 436 | void tSaw_init (tSaw* const osc); | 440 | void tSaw_init (tSaw* const osc); |
| 437 | void tSaw_initToPool (tSaw* const osc, tMempool* const pool); | 441 | void tSaw_initToPool (tSaw* const osc, tMempool* const mempool); |
| 438 | void tSaw_free (tSaw* const osc); | 442 | void tSaw_free (tSaw* const osc); |
| 439 | 443 | ||
| 440 | float tSaw_tick (tSaw* const osc); | 444 | float tSaw_tick (tSaw* const osc); |
| @@ -555,13 +559,13 @@ extern "C" { · 114 unmodified lines | |||
| 555 | @brief Initialize a tNeuron to the default LEAF mempool. | 559 | @brief Initialize a tNeuron to the default LEAF mempool. |
| 556 | @param neuron A pointer to the tNeuron to be initialized. | 560 | @param neuron A pointer to the tNeuron to be initialized. |
| 557 | 561 | ||
| 558 | @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool) | 562 | @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const mempool) |
| 559 | @brief Initialize a tNeuron to a specified mempool. | 563 | @brief Initialize a tNeuron to a specified mempool. |
| 560 | @param neuron A pointer to the tNeuron to be initialized. | 564 | @param neuron A pointer to the tNeuron to be initialized. |
| 561 | @param pool A pointer to the tMempool to which the tNeuron should be initialized. | 565 | @param mempool A pointer to the tMempool to which the tNeuron should be initialized. |
| 562 | 566 | ||
| 563 | @fn void tNeuron_free (tNeuron* const neuron) | 567 | @fn void tNeuron_free (tNeuron* const neuron) |
| 564 | @brief Free a tNeuron from the default LEAF mempool. | 568 | @brief Free a tNeuron from its mempool. |
| 565 | @param neuron A pointer to the tNeuron to be freed. | 569 | @param neuron A pointer to the tNeuron to be freed. |
| 566 | 570 | ||
| 567 | @fn void tNeuron_reset (tNeuron* const neuron) | 571 | @fn void tNeuron_reset (tNeuron* const neuron) |
| @@ -659,7 +663,7 @@ extern "C" { · 91 unmodified lines | |||
| 659 | typedef _tNeuron* tNeuron; | 663 | typedef _tNeuron* tNeuron; |
| 660 | 664 | ||
| 661 | void tNeuron_init (tNeuron* const neuron); | 665 | void tNeuron_init (tNeuron* const neuron); |
| 662 | void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool); | 666 | void tNeuron_initToPool (tNeuron* const neuron, tMempool* const mempool); |
| 663 | void tNeuron_free (tNeuron* const neuron); | 667 | void tNeuron_free (tNeuron* const neuron); |
| 664 | 668 | ||
| 665 | void tNeuron_reset (tNeuron* const neuron); | 669 | void tNeuron_reset (tNeuron* const neuron); |
| @@ -692,7 +696,7 @@ extern "C" { · 26 unmodified lines | |||
| 692 | @brief | 696 | @brief |
| 693 | @param | 697 | @param |
| 694 | 698 | ||
| 695 | @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool) | 699 | @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const mempool) |
| 696 | @brief | 700 | @brief |
| 697 | @param | 701 | @param |
| 698 | 702 | ||
| @@ -741,7 +745,7 @@ extern "C" { · 42 unmodified lines | |||
| 741 | typedef _tMBPulse* tMBPulse; | 745 | typedef _tMBPulse* tMBPulse; |
| 742 | 746 | ||
| 743 | void tMBPulse_init(tMBPulse* const osc); | 747 | void tMBPulse_init(tMBPulse* const osc); |
| 744 | void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool); | 748 | void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const mempool); |
| 745 | void tMBPulse_free(tMBPulse* const osc); | 749 | void tMBPulse_free(tMBPulse* const osc); |
| 746 | 750 | ||
| 747 | float tMBPulse_tick(tMBPulse* const osc); | 751 | float tMBPulse_tick(tMBPulse* const osc); |
| @@ -760,7 +764,7 @@ extern "C" { · 12 unmodified lines | |||
| 760 | @brief | 764 | @brief |
| 761 | @param | 765 | @param |
| 762 | 766 | ||
| 763 | @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool) | 767 | @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const mempool) |
| 764 | @brief | 768 | @brief |
| 765 | @param | 769 | @param |
| 766 | 770 | ||
| @@ -809,7 +813,7 @@ extern "C" { · 42 unmodified lines | |||
| 809 | typedef _tMBTriangle* tMBTriangle; | 813 | typedef _tMBTriangle* tMBTriangle; |
| 810 | 814 | ||
| 811 | void tMBTriangle_init(tMBTriangle* const osc); | 815 | void tMBTriangle_init(tMBTriangle* const osc); |
| 812 | void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool); | 816 | void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const mempool); |
| 813 | void tMBTriangle_free(tMBTriangle* const osc); | 817 | void tMBTriangle_free(tMBTriangle* const osc); |
| 814 | 818 | ||
| 815 | float tMBTriangle_tick(tMBTriangle* const osc); | 819 | float tMBTriangle_tick(tMBTriangle* const osc); |
| @@ -829,7 +833,7 @@ extern "C" { · 13 unmodified lines | |||
| 829 | @brief | 833 | @brief |
| 830 | @param | 834 | @param |
| 831 | 835 | ||
| 832 | @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool) | 836 | @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const mempool) |
| 833 | @brief | 837 | @brief |
| 834 | @param | 838 | @param |
| 835 | 839 | ||
| @@ -873,7 +877,7 @@ extern "C" { · 37 unmodified lines | |||
| 873 | typedef _tMBSaw* tMBSaw; | 877 | typedef _tMBSaw* tMBSaw; |
| 874 | 878 | ||
| 875 | void tMBSaw_init(tMBSaw* const osc); | 879 | void tMBSaw_init(tMBSaw* const osc); |
| 876 | void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool); | 880 | void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const mempool); |
| 877 | void tMBSaw_free(tMBSaw* const osc); | 881 | void tMBSaw_free(tMBSaw* const osc); |
| 878 | 882 | ||
| 879 | float tMBSaw_tick(tMBSaw* const osc); | 883 | float tMBSaw_tick(tMBSaw* const osc); |
| @@ -64,16 +64,16 @@ float tEnvelopeFollower_tick(tEnvelopeFollower* const ef, float x) · 63 unmodified lines | |||
| 64 | return e->y; | 64 | return e->y; |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | int tEnvelopeFollower_decayCoeff(tEnvelopeFollower* const ef, float decayCoeff) | 67 | void tEnvelopeFollower_setDecayCoefficient(tEnvelopeFollower* const ef, float decayCoeff) |
| 68 | { | 68 | { |
| 69 | _tEnvelopeFollower* e = *ef; | 69 | _tEnvelopeFollower* e = *ef; |
| 70 | return e->d_coeff = decayCoeff; | 70 | e->d_coeff = decayCoeff; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | int tEnvelopeFollower_attackThresh(tEnvelopeFollower* const ef, float attackThresh) | 73 | void tEnvelopeFollower_setAttackThreshold(tEnvelopeFollower* const ef, float attackThresh) |
| 74 | { | 74 | { |
| 75 | _tEnvelopeFollower* e = *ef; | 75 | _tEnvelopeFollower* e = *ef; |
| 76 | return e->a_thresh = attackThresh; | 76 | e->a_thresh = attackThresh; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | 79 | ||
| @@ -82,15 +82,15 @@ int tEnvelopeFollower_attackThresh(tEnvelopeFollower* const ef, float attack · 2 unmodified lines | |||
| 82 | 82 | ||
| 83 | // zero crossing detector | 83 | // zero crossing detector |
| 84 | 84 | ||
| 85 | void tZeroCrossing_init (tZeroCrossing* const zc, int maxWindowSize) | 85 | void tZeroCrossingCounter_init (tZeroCrossingCounter* const zc, int maxWindowSize) |
| 86 | { | 86 | { |
| 87 | tZeroCrossing_initToPool (zc, maxWindowSize, &leaf.mempool); | 87 | tZeroCrossingCounter_initToPool (zc, maxWindowSize, &leaf.mempool); |
| 88 | } | 88 | } |
| 89 | 89 | ||
| 90 | void tZeroCrossing_initToPool (tZeroCrossing* const zc, int maxWindowSize, tMempool* const mp) | 90 | void tZeroCrossingCounter_initToPool (tZeroCrossingCounter* const zc, int maxWindowSize, tMempool* const mp) |
| 91 | { | 91 | { |
| 92 | _tMempool* m = *mp; | 92 | _tMempool* m = *mp; |
| 93 | _tZeroCrossing* z = *zc = (_tZeroCrossing*) mpool_alloc(sizeof(_tZeroCrossing), m); | 93 | _tZeroCrossingCounter* z = *zc = (_tZeroCrossingCounter*) mpool_alloc(sizeof(_tZeroCrossing), m); |
| 94 | z->mempool = m; | 94 | z->mempool = m; |
| 95 | 95 | ||
| 96 | z->count = 0; | 96 | z->count = 0; |
| @@ -103,9 +103,9 @@ void tZeroCrossing_initToPool (tZeroCrossing* const zc, int maxWindowSize, · 6 unmodified lines | |||
| 103 | z->countBuffer = (uint16_t*) mpool_calloc(sizeof(uint16_t) * maxWindowSize, m); | 103 | z->countBuffer = (uint16_t*) mpool_calloc(sizeof(uint16_t) * maxWindowSize, m); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | void tZeroCrossing_free (tZeroCrossing* const zc) | 106 | void tZeroCrossingCounter_free (tZeroCrossingCounter* const zc) |
| 107 | { | 107 | { |
| 108 | _tZeroCrossing* z = *zc; | 108 | _tZeroCrossingCounter* z = *zc; |
| 109 | 109 | ||
| 110 | mpool_free((char*)z->inBuffer, z->mempool); | 110 | mpool_free((char*)z->inBuffer, z->mempool); |
| 111 | mpool_free((char*)z->countBuffer, z->mempool); | 111 | mpool_free((char*)z->countBuffer, z->mempool); |
| @@ -113,9 +113,9 @@ void tZeroCrossing_free (tZeroCrossing* const zc) · 1 unmodified line | |||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | //returns proportion of zero crossings within window size (0.0 would be none in window, 1.0 would be all zero crossings) | 115 | //returns proportion of zero crossings within window size (0.0 would be none in window, 1.0 would be all zero crossings) |
| 116 | float tZeroCrossing_tick (tZeroCrossing* const zc, float input) | 116 | float tZeroCrossingCounter_tick (tZeroCrossingCounter* const zc, float input) |
| 117 | { | 117 | { |
| 118 | _tZeroCrossing* z = *zc; | 118 | _tZeroCrossingCounter* z = *zc; |
| 119 | 119 | ||
| 120 | z->inBuffer[z->position] = input; | 120 | z->inBuffer[z->position] = input; |
| 121 | int futurePosition = ((z->position + 1) % z->currentWindowSize); | 121 | int futurePosition = ((z->position + 1) % z->currentWindowSize); |
| @@ -152,9 +152,9 @@ float tZeroCrossing_tick (tZeroCrossing* const zc, float input) · 30 unmodified lines | |||
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | 154 | ||
| 155 | void tZeroCrossing_setWindow (tZeroCrossing* const zc, float windowSize) | 155 | void tZeroCrossingCounter_setWindowSize (tZeroCrossingCounter* const zc, float windowSize) |
| 156 | { | 156 | { |
| 157 | _tZeroCrossing* z = *zc; | 157 | _tZeroCrossingCounter* z = *zc; |
| 158 | if (windowSize <= z->maxWindowSize) | 158 | if (windowSize <= z->maxWindowSize) |
| 159 | { | 159 | { |
| 160 | z->currentWindowSize = windowSize; | 160 | z->currentWindowSize = windowSize; |
| @@ -285,11 +285,11 @@ void tTalkbox_lpc(float *buf, float *car, double* dl, double* Rt, int32_t n, int · 284 unmodified lines | |||
| 285 | { | 285 | { |
| 286 | if(r[0] < min) | 286 | if(r[0] < min) |
| 287 | { | 287 | { |
| 288 | for(i=0; i<n; i++) | 288 | // for(i=0; i<n; i++) |
| 289 | { | 289 | // { |
| 290 | buf[i] = 0.0f; | 290 | buf[i] = 0.0f; |
| 291 | return; | 291 | return; |
| 292 | } | 292 | // } |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | tTalkbox_lpcDurbin(r, o, k, G); //calc reflection coeffs | 295 | tTalkbox_lpcDurbin(r, o, k, G); //calc reflection coeffs |
| @@ -612,11 +612,11 @@ void tTalkboxFloat_lpc(float *buf, float *car, float* dl, float* Rt, int32_t n, · 316 unmodified lines | |||
| 612 | { | 612 | { |
| 613 | if(r[0] < min) | 613 | if(r[0] < min) |
| 614 | { | 614 | { |
| 615 | for(i=0; i<n; i++) | 615 | // for(i=0; i<n; i++) |
| 616 | { | 616 | // { |
| 617 | buf[i] = 0.0f; | 617 | buf[i] = 0.0f; |
| 618 | return; | 618 | return; |
| 619 | } | 619 | // } |
| 620 | } | 620 | } |
| 621 | 621 | ||
| 622 | tTalkbox_lpcDurbin(r, o, k, G); //calc reflection coeffs | 622 | tTalkbox_lpcDurbin(r, o, k, G); //calc reflection coeffs |