Unified · Split
| @@ -10,4 +10,4 @@ · 9 unmodified lines | |||
| 10 | *.swp | 10 | *.swp |
| 11 | */Builds | 11 | */Builds |
| 12 | */JuceLibraryCode | 12 | */JuceLibraryCode |
| 13 | doxygen/html | 13 | doxygen/leaf |
| @@ -37,45 +37,32 @@ extern "C" { · 36 unmodified lines | |||
| 37 | @ingroup analysis | 37 | @ingroup analysis |
| 38 | @brief | 38 | @brief |
| 39 | @{ | 39 | @{ |
| 40 | */ | 40 | |
| 41 | |||
| 42 | /*! | ||
| 43 | @fn void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff) | 41 | @fn void tEnvelopeFollower_init (tEnvelopeFollower* const, float attackThreshold, float decayCoeff) |
| 44 | @brief | 42 | @brief |
| 45 | @param | 43 | @param |
| 46 | */ | 44 | |
| 47 | |||
| 48 | /*! | ||
| 49 | @fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const) | 45 | @fn void tEnvelopeFollower_initToPool (tEnvelopeFollower* const, float attackThreshold, float decayCoeff, tMempool* const) |
| 50 | @brief | 46 | @brief |
| 51 | @param | 47 | @param |
| 52 | */ | 48 | |
| 53 | |||
| 54 | /*! | ||
| 55 | @fn void tEnvelopeFollower_free (tEnvelopeFollower* const) | 49 | @fn void tEnvelopeFollower_free (tEnvelopeFollower* const) |
| 56 | @brief | 50 | @brief |
| 57 | @param | 51 | @param |
| 58 | */ | 52 | |
| 59 | |||
| 60 | /*! | ||
| 61 | @fn float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x) | 53 | @fn float tEnvelopeFollower_tick (tEnvelopeFollower* const, float x) |
| 62 | @brief | 54 | @brief |
| 63 | @param | 55 | @param |
| 64 | */ | 56 | |
| 65 | |||
| 66 | /*! | ||
| 67 | @fn int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff) | 57 | @fn int tEnvelopeFollower_decayCoeff (tEnvelopeFollower* const, float decayCoeff) |
| 68 | @brief | 58 | @brief |
| 69 | @param | 59 | @param |
| 70 | */ | 60 | |
| 71 | |||
| 72 | /*! | ||
| 73 | @fn int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh) | 61 | @fn int tEnvelopeFollower_attackThresh (tEnvelopeFollower* const, float attackThresh) |
| 74 | @brief | 62 | @brief |
| 75 | @param | 63 | @param |
| 76 | */ | 64 |  |
| 77 | 65 | @} */ | |
| 78 | /*! @} */ | ||
| 79 | 66 | ||
| 80 | typedef struct _tEnvelopeFollower | 67 | typedef struct _tEnvelopeFollower |
| 81 | { | 68 | { |
| @@ -103,39 +90,28 @@ extern "C" { · 21 unmodified lines | |||
| 103 | @ingroup analysis | 90 | @ingroup analysis |
| 104 | @brief | 91 | @brief |
| 105 | @{ | 92 | @{ |
| 106 | */ | 93 | |
| 107 | |||
| 108 | /*! | ||
| 109 | @fn void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize) | 94 | @fn void tZeroCrossing_init (tZeroCrossing* const, int maxWindowSize) |
| 110 | @brief | 95 | @brief |
| 111 | @param | 96 | @param |
| 112 | */ | 97 | |
| 113 | |||
| 114 | /*! | ||
| 115 | @fn void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const) | 98 | @fn void tZeroCrossing_initToPool (tZeroCrossing* const, int maxWindowSize, tMempool* const) |
| 116 | @brief | 99 | @brief |
| 117 | @param | 100 | @param |
| 118 | */ | 101 | |
| 119 | |||
| 120 | /*! | ||
| 121 | @fn void tZeroCrossing_free (tZeroCrossing* const) | 102 | @fn void tZeroCrossing_free (tZeroCrossing* const) |
| 122 | @brief | 103 | @brief |
| 123 | @param | 104 | @param |
| 124 | */ | 105 | |
| 125 | |||
| 126 | /*! | ||
| 127 | @fn float tZeroCrossing_tick (tZeroCrossing* const, float input) | 106 | @fn float tZeroCrossing_tick (tZeroCrossing* const, float input) |
| 128 | @brief | 107 | @brief |
| 129 | @param | 108 | @param |
| 130 | */ | 109 | |
| 131 | |||
| 132 | /*! | ||
| 133 | @fn void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize) | 110 | @fn void tZeroCrossing_setWindow (tZeroCrossing* const, float windowSize) |
| 134 | @brief | 111 | @brief |
| 135 | @param | 112 | @param |
| 136 | */ | 113 |  |
| 137 | 114 | @} */ | |
| 138 | /*! @} */ | ||
| 139 | 115 | ||
| 140 | /* Zero Crossing Detector */ | 116 | /* Zero Crossing Detector */ |
| 141 | typedef struct _tZeroCrossing { | 117 | typedef struct _tZeroCrossing { |
| @@ -166,45 +142,32 @@ extern "C" { · 24 unmodified lines | |||
| 166 | @ingroup analysis | 142 | @ingroup analysis |
| 167 | @brief | 143 | @brief |
| 168 | @{ | 144 | @{ |
| 169 | */ | 145 | |
| 170 | |||
| 171 | /*! | ||
| 172 | @fn void tPowerFollower_init (tPowerFollower* const, float factor) | 146 | @fn void tPowerFollower_init (tPowerFollower* const, float factor) |
| 173 | @brief | 147 | @brief |
| 174 | @param | 148 | @param |
| 175 | */ | 149 | |
| 176 | |||
| 177 | /*! | ||
| 178 | @fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const) | 150 | @fn void tPowerFollower_initToPool (tPowerFollower* const, float factor, tMempool* const) |
| 179 | @brief | 151 | @brief |
| 180 | @param | 152 | @param |
| 181 | */ | 153 | |
| 182 | |||
| 183 | /*! | ||
| 184 | @fn void tPowerFollower_free (tPowerFollower* const) | 154 | @fn void tPowerFollower_free (tPowerFollower* const) |
| 185 | @brief | 155 | @brief |
| 186 | @param | 156 | @param |
| 187 | */ | 157 | |
| 188 | |||
| 189 | /*! | ||
| 190 | @fn float tPowerFollower_tick (tPowerFollower* const, float input) | 158 | @fn float tPowerFollower_tick (tPowerFollower* const, float input) |
| 191 | @brief | 159 | @brief |
| 192 | @param | 160 | @param |
| 193 | */ | 161 | |
| 194 | |||
| 195 | /*! | ||
| 196 | @fn float tPowerFollower_sample (tPowerFollower* const) | 162 | @fn float tPowerFollower_sample (tPowerFollower* const) |
| 197 | @brief | 163 | @brief |
| 198 | @param | 164 | @param |
| 199 | */ | 165 | |
| 200 | |||
| 201 | /*! | ||
| 202 | @fn int tPowerFollower_setFactor (tPowerFollower* const, float factor) | 166 | @fn int tPowerFollower_setFactor (tPowerFollower* const, float factor) |
| 203 | @brief | 167 | @brief |
| 204 | @param | 168 | @param |
| 205 | */ | 169 |  |
| 206 | 170 | @} */ | |
| 207 | /*! @} */ | ||
| 208 | 171 | ||
| 209 | /* PowerEnvelopeFollower */ | 172 | /* PowerEnvelopeFollower */ |
| 210 | typedef struct _tPowerFollower | 173 | typedef struct _tPowerFollower |
| @@ -232,40 +195,28 @@ extern "C" { · 21 unmodified lines | |||
| 232 | @ingroup analysis | 195 | @ingroup analysis |
| 233 | @brief | 196 | @brief |
| 234 | @{ | 197 | @{ |
| 235 | */ | 198 | |
| 236 | |||
| 237 | /*! | ||
| 238 | @fn void tEnvPD_init (tEnvPD* const, int windowSize, int hopSize, int blockSize) | 199 | @fn void tEnvPD_init (tEnvPD* const, int windowSize, int hopSize, int blockSize) |
| 239 | @brief | 200 | @brief |
| 240 | @param | 201 | @param |
| 241 | */ | 202 | |
| 242 | |||
| 243 | /*! | ||
| 244 | @fn void tEnvPD_initToPool (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const) | 203 | @fn void tEnvPD_initToPool (tEnvPD* const, int windowSize, int hopSize, int blockSize, tMempool* const) |
| 245 | @brief | 204 | @brief |
| 246 | @param | 205 | @param |
| 247 | */ | 206 | |
| 248 | |||
| 249 | /*! | ||
| 250 | @fn void tEnvPD_free (tEnvPD* const) | 207 | @fn void tEnvPD_free (tEnvPD* const) |
| 251 | @brief | 208 | @brief |
| 252 | @param | 209 | @param |
| 253 | */ | 210 | |
| 254 | |||
| 255 | |||
| 256 | /*! | ||
| 257 | @fn float tEnvPD_tick (tEnvPD* const) | 211 | @fn float tEnvPD_tick (tEnvPD* const) |
| 258 | @brief | 212 | @brief |
| 259 | @param | 213 | @param |
| 260 | */ | 214 | |
| 261 | |||
| 262 | /*! | ||
| 263 | @fn void tEnvPD_processBlock (tEnvPD* const, float* in) | 215 | @fn void tEnvPD_processBlock (tEnvPD* const, float* in) |
| 264 | @brief | 216 | @brief |
| 265 | @param | 217 | @param |
| 266 | */ | 218 |  |
| 267 | 219 | @} */ | |
| 268 | /*! @} */ | ||
| 269 | 220 | ||
| 270 | // ENV~ from PD, modified for LEAF | 221 | // ENV~ from PD, modified for LEAF |
| 271 | #define MAXOVERLAP 32 | 222 | #define MAXOVERLAP 32 |
| @@ -304,63 +255,44 @@ extern "C" { · 32 unmodified lines | |||
| 304 | @ingroup analysis | 255 | @ingroup analysis |
| 305 | @brief | 256 | @brief |
| 306 | @{ | 257 | @{ |
| 307 | */ | 258 | |
| 308 | |||
| 309 | /*! | ||
| 310 | @fn void tAttackDetection_init (tAttackDetection* const, int blocksize, int atk, int rel) | 259 | @fn void tAttackDetection_init (tAttackDetection* const, int blocksize, int atk, int rel) |
| 311 | @brief | 260 | @brief |
| 312 | @param | 261 | @param |
| 313 | */ | 262 | |
| 314 | |||
| 315 | /*! | ||
| 316 | @fn void tAttackDetection_initToPool (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const) | 263 | @fn void tAttackDetection_initToPool (tAttackDetection* const, int blocksize, int atk, int rel, tMempool* const) |
| 317 | @brief | 264 | @brief |
| 318 | @param | 265 | @param |
| 319 | */ | 266 | |
| 320 | |||
| 321 | /*! | ||
| 322 | @fn void tAttackDetection_free (tAttackDetection* const) | 267 | @fn void tAttackDetection_free (tAttackDetection* const) |
| 323 | @brief | 268 | @brief |
| 324 | @param | 269 | @param |
| 325 | */ | 270 | |
| 326 | |||
| 327 | /*! | ||
| 328 | @fn void tAttackDetection_setBlocksize (tAttackDetection* const, int size) | 271 | @fn void tAttackDetection_setBlocksize (tAttackDetection* const, int size) |
| 329 | @brief Set expected input blocksize | 272 | @brief Set expected input blocksize |
| 330 | @param | 273 | @param |
| 331 | */ | 274 | |
| 332 | |||
| 333 | /*! | ||
| 334 | @fn void tAttackDetection_setSamplerate (tAttackDetection* const, int inRate) | 275 | @fn void tAttackDetection_setSamplerate (tAttackDetection* const, int inRate) |
| 335 | @brief Set attack detection sample rate | 276 | @brief Set attack detection sample rate |
| 336 | @param | 277 | @param |
| 337 | */ | 278 | |
| 338 | |||
| 339 | /*! | ||
| 340 | @fn void tAttackDetection_setAttack (tAttackDetection* const, int inAtk) | 279 | @fn void tAttackDetection_setAttack (tAttackDetection* const, int inAtk) |
| 341 | @brief Set attack time and coeff | 280 | @brief Set attack time and coeff |
| 342 | @param | 281 | @param |
| 343 | */ | 282 | |
| 344 | |||
| 345 | /*! | ||
| 346 | @fn void tAttackDetection_setRelease (tAttackDetection* const, int inRel) | 283 | @fn void tAttackDetection_setRelease (tAttackDetection* const, int inRel) |
| 347 | @brief Set release time and coeff | 284 | @brief Set release time and coeff |
| 348 | @param | 285 | @param |
| 349 | */ | 286 | |
| 350 | |||
| 351 | /*! | ||
| 352 | @fn void tAttackDetection_setThreshold (tAttackDetection* const, float thres) | 287 | @fn void tAttackDetection_setThreshold (tAttackDetection* const, float thres) |
| 353 | @brief Set level above which values are identified as attacks | 288 | @brief Set level above which values are identified as attacks |
| 354 | @param | 289 | @param |
| 355 | */ | 290 | |
| 356 | |||
| 357 | /*! | ||
| 358 | @fn int tAttackDetection_detect (tAttackDetection* const, float *in) | 291 | @fn int tAttackDetection_detect (tAttackDetection* const, float *in) |
| 359 | @brief Find the largest transient in input block, return index of attack | 292 | @brief Find the largest transient in input block, return index of attack |
| 360 | @param | 293 | @param |
| 361 | */ | 294 |  |
| 362 | 295 | @} */ | |
| 363 | /*! @} */ | ||
| 364 | 296 | ||
| 365 | #define DEFBLOCKSIZE 1024 | 297 | #define DEFBLOCKSIZE 1024 |
| 366 | #define DEFTHRESHOLD 6 | 298 | #define DEFTHRESHOLD 6 |
| @@ -410,63 +342,44 @@ extern "C" { · 43 unmodified lines | |||
| 410 | @ingroup analysis | 342 | @ingroup analysis |
| 411 | @brief Period detection algorithm from Katja Vetters http://www.katjaas.nl/helmholtz/helmholtz.html | 343 | @brief Period detection algorithm from Katja Vetters http://www.katjaas.nl/helmholtz/helmholtz.html |
| 412 | @{ | 344 | @{ |
| 413 | */ | 345 | |
| 414 | |||
| 415 | /*! | ||
| 416 | @fn void tSNAC_init (tSNAC* const, int overlaparg) | 346 | @fn void tSNAC_init (tSNAC* const, int overlaparg) |
| 417 | @brief | 347 | @brief |
| 418 | @param | 348 | @param |
| 419 | */ | 349 | |
| 420 | |||
| 421 | /*! | ||
| 422 | @fn void tSNAC_initToPool (tSNAC* const, int overlaparg, tMempool* const) | 350 | @fn void tSNAC_initToPool (tSNAC* const, int overlaparg, tMempool* const) |
| 423 | @brief | 351 | @brief |
| 424 | @param | 352 | @param |
| 425 | */ | 353 | |
| 426 | |||
| 427 | /*! | ||
| 428 | @fn void tSNAC_free (tSNAC* const) | 354 | @fn void tSNAC_free (tSNAC* const) |
| 429 | @brief | 355 | @brief |
| 430 | @param | 356 | @param |
| 431 | */ | 357 | |
| 432 | |||
| 433 | /*! | ||
| 434 | @fn void tSNAC_ioSamples (tSNAC *s, float *in, float *out, int size) | 358 | @fn void tSNAC_ioSamples (tSNAC *s, float *in, float *out, int size) |
| 435 | @brief | 359 | @brief |
| 436 | @param | 360 | @param |
| 437 | */ | 361 | |
| 438 | |||
| 439 | /*! | ||
| 440 | @fn void tSNAC_setOverlap (tSNAC *s, int lap) | 362 | @fn void tSNAC_setOverlap (tSNAC *s, int lap) |
| 441 | @brief | 363 | @brief |
| 442 | @param | 364 | @param |
| 443 | */ | 365 | |
| 444 | |||
| 445 | /*! | ||
| 446 | @fn void tSNAC_setBias (tSNAC *s, float bias) | 366 | @fn void tSNAC_setBias (tSNAC *s, float bias) |
| 447 | @brief | 367 | @brief |
| 448 | @param | 368 | @param |
| 449 | */ | 369 | |
| 450 | |||
| 451 | /*! | ||
| 452 | @fn void tSNAC_setMinRMS (tSNAC *s, float rms) | 370 | @fn void tSNAC_setMinRMS (tSNAC *s, float rms) |
| 453 | @brief | 371 | @brief |
| 454 | @param | 372 | @param |
| 455 | */ | 373 | |
| 456 | |||
| 457 | /*! | ||
| 458 | @fn float tSNAC_getPeriod (tSNAC *s) | 374 | @fn float tSNAC_getPeriod (tSNAC *s) |
| 459 | @brief | 375 | @brief |
| 460 | @param | 376 | @param |
| 461 | */ | 377 | |
| 462 | |||
| 463 | /*! | ||
| 464 | @fn float tSNAC_getFidelity (tSNAC *s) | 378 | @fn float tSNAC_getFidelity (tSNAC *s) |
| 465 | @brief | 379 | @brief |
| 466 | @param | 380 | @param |
| 467 | */ | 381 |  |
| 468 | 382 | @} */ | |
| 469 | /*! @} */ | ||
| 470 | 383 | ||
| 471 | #define SNAC_FRAME_SIZE 1024 // default analysis framesize // should be the same as (or smaller than?) PS_FRAME_SIZE | 384 | #define SNAC_FRAME_SIZE 1024 // default analysis framesize // should be the same as (or smaller than?) PS_FRAME_SIZE |
| 472 | #define DEFOVERLAP 1 // default overlap | 385 | #define DEFOVERLAP 1 // default overlap |
| @@ -522,63 +435,44 @@ extern "C" { · 49 unmodified lines | |||
| 522 | @fn void tPeriodDetection_init (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize) | 435 | @fn void tPeriodDetection_init (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize) |
| 523 | @brief | 436 | @brief |
| 524 | @param | 437 | @param |
| 525 | */ | 438 | |
| 526 | |||
| 527 | /*! | ||
| 528 | @fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const) | 439 | @fn void tPeriodDetection_initToPool (tPeriodDetection* const, float* in, float* out, int bufSize, int frameSize, tMempool* const) |
| 529 | @brief | 440 | @brief |
| 530 | @param | 441 | @param |
| 531 | */ | 442 | |
| 532 | |||
| 533 | /*! | ||
| 534 | @fn void tPeriodDetection_free (tPeriodDetection* const) | 443 | @fn void tPeriodDetection_free (tPeriodDetection* const) |
| 535 | @brief | 444 | @brief |
| 536 | @param | 445 | @param |
| 537 | */ | 446 | |
| 538 | |||
| 539 | /*! | ||
| 540 | @fn float tPeriodDetection_tick (tPeriodDetection* const, float sample) | 447 | @fn float tPeriodDetection_tick (tPeriodDetection* const, float sample) |
| 541 | @brief | 448 | @brief |
| 542 | @param | 449 | @param |
| 543 | */ | 450 | |
| 544 | |||
| 545 | /*! | ||
| 546 | @fn float tPeriodDetection_getPeriod (tPeriodDetection* const) | 451 | @fn float tPeriodDetection_getPeriod (tPeriodDetection* const) |
| 547 | @brief | 452 | @brief |
| 548 | @param | 453 | @param |
| 549 | */ | 454 | |
| 550 | |||
| 551 | /*! | ||
| 552 | @fn void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs) | 455 | @fn void tPeriodDetection_setHopSize (tPeriodDetection* const, int hs) |
| 553 | @brief | 456 | @brief |
| 554 | @param | 457 | @param |
| 555 | */ | 458 | |
| 556 | |||
| 557 | /*! | ||
| 558 | @fn void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws) | 459 | @fn void tPeriodDetection_setWindowSize (tPeriodDetection* const, int ws) |
| 559 | @brief | 460 | @brief |
| 560 | @param | 461 | @param |
| 561 | */ | 462 | |
| 562 | |||
| 563 | /*! | ||
| 564 | @fn void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold) | 463 | @fn void tPeriodDetection_setFidelityThreshold(tPeriodDetection* const, float threshold) |
| 565 | @brief | 464 | @brief |
| 566 | @param | 465 | @param |
| 567 | */ | 466 | |
| 568 | |||
| 569 | /*! | ||
| 570 | @fn void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha) | 467 | @fn void tPeriodDetection_setAlpha (tPeriodDetection* const, float alpha) |
| 571 | @brief | 468 | @brief |
| 572 | @param | 469 | @param |
| 573 | */ | 470 | |
| 574 | |||
| 575 | /*! | ||
| 576 | @fn void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance) | 471 | @fn void tPeriodDetection_setTolerance (tPeriodDetection* const, float tolerance) |
| 577 | @brief | 472 | @brief |
| 578 | @param | 473 | @param |
| 579 | */ | 474 |  |
| 580 | 475 | @} */ | |
| 581 | /*! @} */ | ||
| 582 | 476 | ||
| 583 | #define DEFPITCHRATIO 2.0f | 477 | #define DEFPITCHRATIO 2.0f |
| 584 | #define DEFTIMECONSTANT 100.0f | 478 | #define DEFTIMECONSTANT 100.0f |
| @@ -640,6 +534,8 @@ extern "C" { · 55 unmodified lines | |||
| 640 | 534 | ||
| 641 | //============================================================================== | 535 | //============================================================================== |
| 642 | 536 | ||
| 537 | // Maybe keep these up to PeriodDetector internal? | ||
| 538 | |||
| 643 | typedef struct _tZeroCrossing2 | 539 | typedef struct _tZeroCrossing2 |
| 644 | { | 540 | { |
| 645 | tMempool mempool; | 541 | tMempool mempool; |
| @@ -761,6 +657,50 @@ extern "C" { · 115 unmodified lines | |||
| 761 | 657 | ||
| 762 | //============================================================================== | 658 | //============================================================================== |
| 763 | 659 | ||
| 660 | /*! | ||
| 661 | @defgroup tperioddetector tPeriodDetector | ||
| 662 | @ingroup analysis | ||
| 663 | @brief | ||
| 664 | @{ | ||
| 665 | |||
| 666 | @fn void tPeriodDetector_init (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis) | ||
| 667 | @brief | ||
| 668 | @param | ||
| 669 | |||
| 670 | @fn void tPeriodDetector_initToPool (tPeriodDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool) | ||
| 671 | @brief | ||
| 672 | @param | ||
| 673 | |||
| 674 | @fn void tPeriodDetector_free (tPeriodDetector* const detector) | ||
| 675 | @brief | ||
| 676 | @param | ||
| 677 | |||
| 678 | @fn int tPeriodDetector_tick (tPeriodDetector* const detector, float sample) | ||
| 679 | @brief | ||
| 680 | @param | ||
| 681 | |||
| 682 | @fn float tPeriodDetector_getPeriod (tPeriodDetector* const detector) | ||
| 683 | @brief Get the periodicity for a given harmonic of the detected pitch. | ||
| 684 | @param | ||
| 685 | |||
| 686 | @fn float tPeriodDetector_getPeriodicity (tPeriodDetector* const detector) | ||
| 687 | @brief | ||
| 688 | @param | ||
| 689 | |||
| 690 | @fn float tPeriodDetector_harmonic (tPeriodDetector* const detector, int harmonicIndex) | ||
| 691 | @brief | ||
| 692 | @param | ||
| 693 | |||
| 694 | @fn float tPeriodDetector_predictPeriod (tPeriodDetector* const detector) | ||
| 695 | @brief | ||
| 696 | @param | ||
| 697 | |||
| 698 | @fn int tPeriodDetector_isReady (tPeriodDetector* const detector) | ||
| 699 | @brief | ||
| 700 | @param | ||
| 701 |  | ||
| 702 | @} */ | ||
| 703 | |||
| 764 | #define PULSE_THRESHOLD 0.6f | 704 | #define PULSE_THRESHOLD 0.6f |
| 765 | #define HARMONIC_PERIODICITY_FACTOR 16 | 705 | #define HARMONIC_PERIODICITY_FACTOR 16 |
| 766 | #define PERIODICITY_DIFF_FACTOR 0.008f | 706 | #define PERIODICITY_DIFF_FACTOR 0.008f |
| @@ -827,6 +767,50 @@ extern "C" { · 60 unmodified lines | |||
| 827 | 767 | ||
| 828 | //============================================================================== | 768 | //============================================================================== |
| 829 | 769 | ||
| 770 | /*! | ||
| 771 | @defgroup tpitchdetector tPitchDetector | ||
| 772 | @ingroup analysis | ||
| 773 | @brief | ||
| 774 | @{ | ||
| 775 | |||
| 776 | @fn void tPitchDetector_init (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis) | ||
| 777 | @brief | ||
| 778 | @param | ||
| 779 | |||
| 780 | @fn void tPitchDetector_initToPool (tPitchDetector* const detector, float lowestFreq, float highestFreq, float hysteresis, tMempool* const mempool) | ||
| 781 | @brief | ||
| 782 | @param | ||
| 783 | |||
| 784 | @fn void tPitchDetector_free (tPitchDetector* const detector) | ||
| 785 | @brief | ||
| 786 | @param | ||
| 787 | |||
| 788 | @fn int tPitchDetector_tick (tPitchDetector* const detector, float sample) | ||
| 789 | @brief | ||
| 790 | @param | ||
| 791 | |||
| 792 | @fn float tPitchDetector_getFrequency (tPitchDetector* const detector) | ||
| 793 | @brief | ||
| 794 | @param | ||
| 795 | |||
| 796 | @fn float tPitchDetector_getPeriodicity (tPitchDetector* const detector) | ||
| 797 | @brief | ||
| 798 | @param | ||
| 799 | |||
| 800 | @fn float tPitchDetector_harmonic (tPitchDetector* const detector, int harmonicIndex) | ||
| 801 | @brief | ||
| 802 | @param | ||
| 803 | |||
| 804 | @fn float tPitchDetector_predictFrequency (tPitchDetector* const detector, int init) | ||
| 805 | @brief | ||
| 806 | @param | ||
| 807 | |||
| 808 | @fn void tPitchDetector_reset (tPitchDetector* const detector) | ||
| 809 | @brief | ||
| 810 | @param | ||
| 811 |  | ||
| 812 | @} */ | ||
| 813 | |||
| 830 | #define MAX_DEVIATION 0.9f | 814 | #define MAX_DEVIATION 0.9f |
| 831 | #define MIN_PERIODICITY 0.8f | 815 | #define MIN_PERIODICITY 0.8f |
| 832 | 816 | ||
| @@ -33,81 +33,56 @@ extern "C" { · 32 unmodified lines | |||
| 33 | @ingroup delay | 33 | @ingroup delay |
| 34 | @brief Non-interpolating delay, reimplemented from STK (Cook and Scavone). | 34 | @brief Non-interpolating delay, reimplemented from STK (Cook and Scavone). |
| 35 | @{ | 35 | @{ |
| 36 | */ | 36 | |
| 37 | |||
| 38 | /*! | ||
| 39 | @fn void tDelay_init (tDelay* const, uint32_t delay, uint32_t maxDelay) | 37 | @fn void tDelay_init (tDelay* const, uint32_t delay, uint32_t maxDelay) |
| 40 | @brief | 38 | @brief |
| 41 | @param | 39 | @param |
| 42 | */ | 40 | |
| 43 | |||
| 44 | /*! | ||
| 45 | @fn void tDelay_initToPool (tDelay* const, uint32_t delay, uint32_t maxDelay, tMempool* const) | 41 | @fn void tDelay_initToPool (tDelay* const, uint32_t delay, uint32_t maxDelay, tMempool* const) |
| 46 | @brief | 42 | @brief |
| 47 | @param | 43 | @param |
| 48 | */ | 44 | |
| 49 | |||
| 50 | /*! | ||
| 51 | @fn void tDelay_free (tDelay* const) | 45 | @fn void tDelay_free (tDelay* const) |
| 52 | @brief | 46 | @brief |
| 53 | @param | 47 | @param |
| 54 | */ | 48 | |
| 55 | |||
| 56 | /*! | ||
| 57 | @fn void tDelay_clear (tDelay* const) | 49 | @fn void tDelay_clear (tDelay* const) |
| 58 | @brief | 50 | @brief |
| 59 | @param | 51 | @param |
| 60 | */ | 52 | |
| 61 | |||
| 62 | /*! | ||
| 63 | @fn int tDelay_setDelay (tDelay* const, uint32_t delay) | 53 | @fn int tDelay_setDelay (tDelay* const, uint32_t delay) |
| 64 | @brief | 54 | @brief |
| 65 | @param | 55 | @param |
| 66 | */ | 56 | |
| 67 | |||
| 68 | /*! | ||
| 69 | @fn uint32_t tDelay_getDelay (tDelay* const) | 57 | @fn uint32_t tDelay_getDelay (tDelay* const) |
| 70 | @brief | 58 | @brief |
| 71 | @param | 59 | @param |
| 72 | */ | 60 | |
| 73 | |||
| 74 | /*! | ||
| 75 | @fn void tDelay_tapIn (tDelay* const, float in, uint32_t tapDelay) | 61 | @fn void tDelay_tapIn (tDelay* const, float in, uint32_t tapDelay) |
| 76 | @brief | 62 | @brief |
| 77 | @param | 63 | @param |
| 78 | */ | 64 | |
| 79 | |||
| 80 | /*! | ||
| 81 | @fn float tDelay_tapOut (tDelay* const, uint32_t tapDelay) | 65 | @fn float tDelay_tapOut (tDelay* const, uint32_t tapDelay) |
| 82 | @brief | 66 | @brief |
| 83 | @param | 67 | @param |
| 84 | */ | 68 | |
| 85 | |||
| 86 | /*! | ||
| 87 | @fn float tDelay_addTo (tDelay* const, float value, uint32_t tapDelay) | 69 | @fn float tDelay_addTo (tDelay* const, float value, uint32_t tapDelay) |
| 88 | @brief | 70 | @brief |
| 89 | @param | 71 | @param |
| 90 | */ | 72 | |
| 91 | |||
| 92 | /*! | ||
| 93 | @fn float tDelay_tick (tDelay* const, float sample) | 73 | @fn float tDelay_tick (tDelay* const, float sample) |
| 94 | @brief | 74 | @brief |
| 95 | @param | 75 | @param |
| 96 | */ | 76 | |
| 97 | |||
| 98 | /*! | ||
| 99 | @fn float tDelay_getLastOut (tDelay* const) | 77 | @fn float tDelay_getLastOut (tDelay* const) |
| 100 | @brief | 78 | @brief |
| 101 | @param | 79 | @param |
| 102 | */ | 80 | |
| 103 | |||
| 104 | /*! | ||
| 105 | @fn float tDelay_getLastIn (tDelay* const) | 81 | @fn float tDelay_getLastIn (tDelay* const) |
| 106 | @brief | 82 | @brief |
| 107 | @param | 83 | @param |
| 108 | */ | 84 |  |
| 109 | 85 | @} */ | |
| 110 | /*! @} */ | ||
| 111 | 86 | ||
| 112 | typedef struct _tDelay | 87 | typedef struct _tDelay |
| 113 | { | 88 | { |
| @@ -147,93 +122,64 @@ extern "C" { · 33 unmodified lines | |||
| 147 | @ingroup delay | 122 | @ingroup delay |
| 148 | @brief Linearly-interpolating delay, reimplemented from STK (Cook and Scavone). | 123 | @brief Linearly-interpolating delay, reimplemented from STK (Cook and Scavone). |
| 149 | @{ | 124 | @{ |
| 150 | */ | 125 | |
| 151 | |||
| 152 | /*! | ||
| 153 | @fn void tLinearDelay_init (tLinearDelay* const, float delay, uint32_t maxDelay) | 126 | @fn void tLinearDelay_init (tLinearDelay* const, float delay, uint32_t maxDelay) |
| 154 | @brief | 127 | @brief |
| 155 | @param | 128 | @param |
| 156 | */ | 129 | |
| 157 | |||
| 158 | /*! | ||
| 159 | @fn void tLinearDelay_initToPool (tLinearDelay* const, float delay, uint32_t maxDelay, tMempool* const) | 130 | @fn void tLinearDelay_initToPool (tLinearDelay* const, float delay, uint32_t maxDelay, tMempool* const) |
| 160 | @brief | 131 | @brief |
| 161 | @param | 132 | @param |
| 162 | */ | 133 | |
| 163 | |||
| 164 | /*! | ||
| 165 | @fn void tLinearDelay_free (tLinearDelay* const) | 134 | @fn void tLinearDelay_free (tLinearDelay* const) |
| 166 | @brief | 135 | @brief |
| 167 | @param | 136 | @param |
| 168 | */ | 137 | |
| 169 | |||
| 170 | /*! | ||
| 171 | @fn void tLinearDelay_clear (tLinearDelay* const dl) | 138 | @fn void tLinearDelay_clear (tLinearDelay* const dl) |
| 172 | @brief | 139 | @brief |
| 173 | @param | 140 | @param |
| 174 | */ | 141 | |
| 175 | |||
| 176 | /*! | ||
| 177 | @fn int tLinearDelay_setDelay (tLinearDelay* const, float delay) | 142 | @fn int tLinearDelay_setDelay (tLinearDelay* const, float delay) |
| 178 | @brief | 143 | @brief |
| 179 | @param | 144 | @param |
| 180 | */ | 145 | |
| 181 | |||
| 182 | /*! | ||
| 183 | @fn float tLinearDelay_getDelay (tLinearDelay* const) | 146 | @fn float tLinearDelay_getDelay (tLinearDelay* const) |
| 184 | @brief | 147 | @brief |
| 185 | @param | 148 | @param |
| 186 | */ | 149 | |
| 187 | |||
| 188 | /*! | ||
| 189 | @fn void tLinearDelay_tapIn (tLinearDelay* const, float in, uint32_t tapDelay) | 150 | @fn void tLinearDelay_tapIn (tLinearDelay* const, float in, uint32_t tapDelay) |
| 190 | @brief | 151 | @brief |
| 191 | @param | 152 | @param |
| 192 | */ | 153 | |
| 193 | |||
| 194 | /*! | ||
| 195 | @fn float tLinearDelay_tapOut (tLinearDelay* const, uint32_t tapDelay) | 154 | @fn float tLinearDelay_tapOut (tLinearDelay* const, uint32_t tapDelay) |
| 196 | @brief | 155 | @brief |
| 197 | @param | 156 | @param |
| 198 | */ | 157 | |
| 199 | |||
| 200 | /*! | ||
| 201 | @fn float tLinearDelay_addTo (tLinearDelay* const, float value, uint32_t tapDelay) | 158 | @fn float tLinearDelay_addTo (tLinearDelay* const, float value, uint32_t tapDelay) |
| 202 | @brief | 159 | @brief |
| 203 | @param | 160 | @param |
| 204 | */ | 161 | |
| 205 | |||
| 206 | /*! | ||
| 207 | @fn float tLinearDelay_tick (tLinearDelay* const, float sample) | 162 | @fn float tLinearDelay_tick (tLinearDelay* const, float sample) |
| 208 | @brief | 163 | @brief |
| 209 | @param | 164 | @param |
| 210 | */ | 165 | |
| 211 | |||
| 212 | /*! | ||
| 213 | @fn void tLinearDelay_tickIn (tLinearDelay* const, float input) | 166 | @fn void tLinearDelay_tickIn (tLinearDelay* const, float input) |
| 214 | @brief | 167 | @brief |
| 215 | @param | 168 | @param |
| 216 | */ | 169 | |
| 217 | |||
| 218 | /*! | ||
| 219 | @fn float tLinearDelay_tickOut (tLinearDelay* const) | 170 | @fn float tLinearDelay_tickOut (tLinearDelay* const) |
| 220 | @brief | 171 | @brief |
| 221 | @param | 172 | @param |
| 222 | */ | 173 | |
| 223 | |||
| 224 | /*! | ||
| 225 | @fn float tLinearDelay_getLastOut (tLinearDelay* const) | 174 | @fn float tLinearDelay_getLastOut (tLinearDelay* const) |
| 226 | @brief | 175 | @brief |
| 227 | @param | 176 | @param |
| 228 | */ | 177 | |
| 229 | |||
| 230 | /*! | ||
| 231 | @fn float tLinearDelay_getLastIn (tLinearDelay* const) | 178 | @fn float tLinearDelay_getLastIn (tLinearDelay* const) |
| 232 | @brief | 179 | @brief |
| 233 | @param | 180 | @param |
| 234 | */ | 181 |  |
| 235 | 182 | @} */ | |
| 236 | /*! @} */ | ||
| 237 | 183 | ||
| 238 | typedef struct _tLinearDelay | 184 | typedef struct _tLinearDelay |
| 239 | { | 185 | { |
| @@ -281,105 +227,72 @@ extern "C" { · 41 unmodified lines | |||
| 281 | @ingroup delay | 227 | @ingroup delay |
| 282 | @brief Hermite-interpolating delay, created by adapting STK linear delay with Hermite interpolation. | 228 | @brief Hermite-interpolating delay, created by adapting STK linear delay with Hermite interpolation. |
| 283 | @{ | 229 | @{ |
| 284 | */ | 230 | |
| 285 | |||
| 286 | /*! | ||
| 287 | @fn void tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay) | 231 | @fn void tHermiteDelay_init (tHermiteDelay* const dl, float delay, uint32_t maxDelay) |
| 288 | @brief | 232 | @brief |
| 289 | @param | 233 | @param |
| 290 | */ | 234 | |
| 291 | |||
| 292 | /*! | ||
| 293 | @fn void tHermiteDelay_initToPool (tHermiteDelay* const dl, float delay, uint32_t maxDelay, tMempool* const mp) | 235 | @fn void tHermiteDelay_initToPool (tHermiteDelay* const dl, float delay, uint32_t maxDelay, tMempool* const mp) |
| 294 | @brief | 236 | @brief |
| 295 | @param | 237 | @param |
| 296 | */ | 238 | |
| 297 | |||
| 298 | /*! | ||
| 299 | @fn void tHermiteDelay_free (tHermiteDelay* const dl) | 239 | @fn void tHermiteDelay_free (tHermiteDelay* const dl) |
| 300 | @brief | 240 | @brief |
| 301 | @param | 241 | @param |
| 302 | */ | 242 | |
| 303 | |||
| 304 | /*! | ||
| 305 | @fn void tHermiteDelay_clear (tHermiteDelay* const dl) | 243 | @fn void tHermiteDelay_clear (tHermiteDelay* const dl) |
| 306 | @brief | 244 | @brief |
| 307 | @param | 245 | @param |
| 308 | */ | 246 | |
| 309 | |||
| 310 | /*! | ||
| 311 | @fn float tHermiteDelay_tick (tHermiteDelay* const dl, float input) | 247 | @fn float tHermiteDelay_tick (tHermiteDelay* const dl, float input) |
| 312 | @brief | 248 | @brief |
| 313 | @param | 249 | @param |
| 314 | */ | 250 | |
| 315 | |||
| 316 | /*! | ||
| 317 | @fn void tHermiteDelay_tickIn (tHermiteDelay* const dl, float input) | 251 | @fn void tHermiteDelay_tickIn (tHermiteDelay* const dl, float input) |
| 318 | @brief | 252 | @brief |
| 319 | @param | 253 | @param |
| 320 | */ | 254 | |
| 321 | |||
| 322 | /*! | ||
| 323 | @fn float tHermiteDelay_tickOut (tHermiteDelay* const dl) | 255 | @fn float tHermiteDelay_tickOut (tHermiteDelay* const dl) |
| 324 | @brief | 256 | @brief |
| 325 | @param | 257 | @param |
| 326 | */ | 258 | |
| 327 | |||
| 328 | /*! | ||
| 329 | @fn int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay) | 259 | @fn int tHermiteDelay_setDelay (tHermiteDelay* const dl, float delay) |
| 330 | @brief | 260 | @brief |
| 331 | @param | 261 | @param |
| 332 | */ | 262 | |
| 333 | |||
| 334 | /*! | ||
| 335 | @fn float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay) | 263 | @fn float tHermiteDelay_tapOut (tHermiteDelay* const dl, uint32_t tapDelay) |
| 336 | @brief | 264 | @brief |
| 337 | @param | 265 | @param |
| 338 | */ | 266 | |
| 339 | |||
| 340 | /*! | ||
| 341 | @fn void tHermiteDelay_tapIn (tHermiteDelay* const dl, float value, uint32_t tapDelay) | 267 | @fn void tHermiteDelay_tapIn (tHermiteDelay* const dl, float value, uint32_t tapDelay) |
| 342 | @brief | 268 | @brief |
| 343 | @param | 269 | @param |
| 344 | */ | 270 | |
| 345 | |||
| 346 | /*! | ||
| 347 | @fn float tHermiteDelay_addTo (tHermiteDelay* const dl, float value, uint32_t tapDelay) | 271 | @fn float tHermiteDelay_addTo (tHermiteDelay* const dl, float value, uint32_t tapDelay) |
| 348 | @brief | 272 | @brief |
| 349 | @param | 273 | @param |
| 350 | */ | 274 | |
| 351 | |||
| 352 | /*! | ||
| 353 | @fn float tHermiteDelay_getDelay (tHermiteDelay* const dl) | 275 | @fn float tHermiteDelay_getDelay (tHermiteDelay* const dl) |
| 354 | @brief | 276 | @brief |
| 355 | @param | 277 | @param |
| 356 | */ | 278 | |
| 357 | |||
| 358 | /*! | ||
| 359 | @fn float tHermiteDelay_getLastOut (tHermiteDelay* const dl) | 279 | @fn float tHermiteDelay_getLastOut (tHermiteDelay* const dl) |
| 360 | @brief | 280 | @brief |
| 361 | @param | 281 | @param |
| 362 | */ | 282 | |
| 363 | |||
| 364 | /*! | ||
| 365 | @fn float tHermiteDelay_getLastIn (tHermiteDelay* const dl) | 283 | @fn float tHermiteDelay_getLastIn (tHermiteDelay* const dl) |
| 366 | @brief | 284 | @brief |
| 367 | @param | 285 | @param |
| 368 | */ | 286 | |
| 369 | |||
| 370 | /*! | ||
| 371 | @fn void tHermiteDelay_setGain (tHermiteDelay* const dl, float gain) | 287 | @fn void tHermiteDelay_setGain (tHermiteDelay* const dl, float gain) |
| 372 | @brief | 288 | @brief |
| 373 | @param | 289 | @param |
| 374 | */ | 290 | |
| 375 | |||
| 376 | /*! | ||
| 377 | @fn float tHermiteDelay_getGain (tHermiteDelay* const dl) | 291 | @fn float tHermiteDelay_getGain (tHermiteDelay* const dl) |
| 378 | @brief | 292 | @brief |
| 379 | @param | 293 | @param |
| 380 | */ | 294 |  |
| 381 | 295 | @} */ | |
| 382 | /*! @} */ | ||
| 383 | 296 | ||
| 384 | typedef struct _tHermiteDelay | 297 | typedef struct _tHermiteDelay |
| 385 | { | 298 | { |
| @@ -427,81 +340,56 @@ extern "C" { · 41 unmodified lines | |||
| 427 | @ingroup delay | 340 | @ingroup delay |
| 428 | @brief Allpass-interpolating delay, reimplemented from STK (Cook and Scavone). | 341 | @brief Allpass-interpolating delay, reimplemented from STK (Cook and Scavone). |
| 429 | @{ | 342 | @{ |
| 430 | */ | 343 | |
| 431 | |||
| 432 | /*! | ||
| 433 | @fn void tAllpassDelay_init (tAllpassDelay* const, float delay, uint32_t maxDelay) | 344 | @fn void tAllpassDelay_init (tAllpassDelay* const, float delay, uint32_t maxDelay) |
| 434 | @brief | 345 | @brief |
| 435 | @param | 346 | @param |
| 436 | */ | 347 | |
| 437 | |||
| 438 | /*! | ||
| 439 | @fn void tAllpassDelay_initToPool (tAllpassDelay* const, float delay, uint32_t maxDelay, tMempool* const) | 348 | @fn void tAllpassDelay_initToPool (tAllpassDelay* const, float delay, uint32_t maxDelay, tMempool* const) |
| 440 | @brief | 349 | @brief |
| 441 | @param | 350 | @param |
| 442 | */ | 351 | |
| 443 | |||
| 444 | /*! | ||
| 445 | @fn void tAllpassDelay_free (tAllpassDelay* const) | 352 | @fn void tAllpassDelay_free (tAllpassDelay* const) |
| 446 | @brief | 353 | @brief |
| 447 | @param | 354 | @param |
| 448 | */ | 355 | |
| 449 | |||
| 450 | /*! | ||
| 451 | @fn void tAllpassDelay_clear (tAllpassDelay* const) | 356 | @fn void tAllpassDelay_clear (tAllpassDelay* const) |
| 452 | @brief | 357 | @brief |
| 453 | @param | 358 | @param |
| 454 | */ | 359 | |
| 455 | |||
| 456 | /*! | ||
| 457 | @fn int tAllpassDelay_setDelay (tAllpassDelay* const, float delay) | 360 | @fn int tAllpassDelay_setDelay (tAllpassDelay* const, float delay) |
| 458 | @brief | 361 | @brief |
| 459 | @param | 362 | @param |
| 460 | */ | 363 | |
| 461 | |||
| 462 | /*! | ||
| 463 | @fn float tAllpassDelay_getDelay (tAllpassDelay* const) | 364 | @fn float tAllpassDelay_getDelay (tAllpassDelay* const) |
| 464 | @brief | 365 | @brief |
| 465 | @param | 366 | @param |
| 466 | */ | 367 | |
| 467 | |||
| 468 | /*! | ||
| 469 | @fn void tAllpassDelay_tapIn (tAllpassDelay* const, float in, uint32_t tapDelay) | 368 | @fn void tAllpassDelay_tapIn (tAllpassDelay* const, float in, uint32_t tapDelay) |
| 470 | @brief | 369 | @brief |
| 471 | @param | 370 | @param |
| 472 | */ | 371 | |
| 473 | |||
| 474 | /*! | ||
| 475 | @fn float tAllpassDelay_tapOut (tAllpassDelay* const, uint32_t tapDelay) | 372 | @fn float tAllpassDelay_tapOut (tAllpassDelay* const, uint32_t tapDelay) |
| 476 | @brief | 373 | @brief |
| 477 | @param | 374 | @param |
| 478 | */ | 375 | |
| 479 | |||
| 480 | /*! | ||
| 481 | @fn float tAllpassDelay_addTo (tAllpassDelay* const, float value, uint32_t tapDelay) | 376 | @fn float tAllpassDelay_addTo (tAllpassDelay* const, float value, uint32_t tapDelay) |
| 482 | @brief | 377 | @brief |
| 483 | @param | 378 | @param |
| 484 | */ | 379 | |
| 485 | |||
| 486 | /*! | ||
| 487 | @fn float tAllpassDelay_tick (tAllpassDelay* const, float sample) | 380 | @fn float tAllpassDelay_tick (tAllpassDelay* const, float sample) |
| 488 | @brief | 381 | @brief |
| 489 | @param | 382 | @param |
| 490 | */ | 383 | |
| 491 | |||
| 492 | /*! | ||
| 493 | @fn float tAllpassDelay_getLastOut (tAllpassDelay* const) | 384 | @fn float tAllpassDelay_getLastOut (tAllpassDelay* const) |
| 494 | @brief | 385 | @brief |
| 495 | @param | 386 | @param |
| 496 | */ | 387 | |
| 497 | |||
| 498 | /*! | ||
| 499 | @fn float tAllpassDelay_getLastIn (tAllpassDelay* const) | 388 | @fn float tAllpassDelay_getLastIn (tAllpassDelay* const) |
| 500 | @brief | 389 | @brief |
| 501 | @param | 390 | @param |
| 502 | */ | 391 |  |
| 503 | 392 | @} */ | |
| 504 | /*! @} */ | ||
| 505 | 393 | ||
| 506 | typedef struct _tAllpassDelay | 394 | typedef struct _tAllpassDelay |
| 507 | { | 395 | { |
| @@ -547,87 +435,60 @@ extern "C" { · 39 unmodified lines | |||
| 547 | @ingroup delay | 435 | @ingroup delay |
| 548 | @brief Linear interpolating delay with fixed read and write pointers, variable rate. | 436 | @brief Linear interpolating delay with fixed read and write pointers, variable rate. |
| 549 | @{ | 437 | @{ |
| 550 | */ | 438 | |
| 551 | |||
| 552 | /*! | ||
| 553 | @fn void tTapeDelay_init (tTapeDelay* const, float delay, uint32_t maxDelay) | 439 | @fn void tTapeDelay_init (tTapeDelay* const, float delay, uint32_t maxDelay) |
| 554 | @brief | 440 | @brief |
| 555 | @param | 441 | @param |
| 556 | */ | 442 | |
| 557 | |||
| 558 | /*! | ||
| 559 | @fn void tTapeDelay_initToPool (tTapeDelay* const, float delay, uint32_t maxDelay, tMempool* const) | 443 | @fn void tTapeDelay_initToPool (tTapeDelay* const, float delay, uint32_t maxDelay, tMempool* const) |
| 560 | @brief | 444 | @brief |
| 561 | @param | 445 | @param |
| 562 | */ | 446 | |
| 563 | |||
| 564 | /*! | ||
| 565 | @fn void tTapeDelay_free (tTapeDelay* const) | 447 | @fn void tTapeDelay_free (tTapeDelay* const) |
| 566 | @brief | 448 | @brief |
| 567 | @param | 449 | @param |
| 568 | */ | 450 | |
| 569 | |||
| 570 | /*! | ||
| 571 | @fn void tTapeDelay_clear (tTapeDelay* const) | 451 | @fn void tTapeDelay_clear (tTapeDelay* const) |
| 572 | @brief | 452 | @brief |
| 573 | @param | 453 | @param |
| 574 | */ | 454 | |
| 575 | |||
| 576 | /*! | ||
| 577 | @fn void tTapeDelay_setDelay (tTapeDelay* const, float delay) | 455 | @fn void tTapeDelay_setDelay (tTapeDelay* const, float delay) |
| 578 | @brief | 456 | @brief |
| 579 | @param | 457 | @param |
| 580 | */ | 458 | |
| 581 | |||
| 582 | /*! | ||
| 583 | @fn float tTapeDelay_getDelay (tTapeDelay* const) | 459 | @fn float tTapeDelay_getDelay (tTapeDelay* const) |
| 584 | @brief | 460 | @brief |
| 585 | @param | 461 | @param |
| 586 | */ | 462 | |
| 587 | |||
| 588 | /*! | ||
| 589 | @fn void tTapeDelay_tapIn (tTapeDelay* const, float in, uint32_t tapDelay) | 463 | @fn void tTapeDelay_tapIn (tTapeDelay* const, float in, uint32_t tapDelay) |
| 590 | @brief | 464 | @brief |
| 591 | @param | 465 | @param |
| 592 | */ | 466 | |
| 593 | |||
| 594 | /*! | ||
| 595 | @fn float tTapeDelay_tapOut (tTapeDelay* const d, float tapDelay) | 467 | @fn float tTapeDelay_tapOut (tTapeDelay* const d, float tapDelay) |
| 596 | @brief | 468 | @brief |
| 597 | @param | 469 | @param |
| 598 | */ | 470 | |
| 599 | |||
| 600 | /*! | ||
| 601 | @fn float tTapeDelay_addTo (tTapeDelay* const, float value, uint32_t tapDelay) | 471 | @fn float tTapeDelay_addTo (tTapeDelay* const, float value, uint32_t tapDelay) |
| 602 | @brief | 472 | @brief |
| 603 | @param | 473 | @param |
| 604 | */ | 474 | |
| 605 | |||
| 606 | /*! | ||
| 607 | @fn float tTapeDelay_tick (tTapeDelay* const, float sample) | 475 | @fn float tTapeDelay_tick (tTapeDelay* const, float sample) |
| 608 | @brief | 476 | @brief |
| 609 | @param | 477 | @param |
| 610 | */ | 478 | |
| 611 | |||
| 612 | /*! | ||
| 613 | @fn void tTapeDelay_incrementInPoint(tTapeDelay* const dl) | 479 | @fn void tTapeDelay_incrementInPoint(tTapeDelay* const dl) |
| 614 | @brief | 480 | @brief |
| 615 | @param | 481 | @param |
| 616 | */ | 482 | |
| 617 | |||
| 618 | /*! | ||
| 619 | @fn float tTapeDelay_getLastOut (tTapeDelay* const) | 483 | @fn float tTapeDelay_getLastOut (tTapeDelay* const) |
| 620 | @brief | 484 | @brief |
| 621 | @param | 485 | @param |
| 622 | */ | 486 | |
| 623 | |||
| 624 | /*! | ||
| 625 | @fn float tTapeDelay_getLastIn (tTapeDelay* const) | 487 | @fn float tTapeDelay_getLastIn (tTapeDelay* const) |
| 626 | @brief | 488 | @brief |
| 627 | @param | 489 | @param |
| 628 | */ | 490 |  |
| 629 | 491 | @} */ | |
| 630 | /*! @} */ | ||
| 631 | 492 | ||
| 632 | typedef struct _tTapeDelay | 493 | typedef struct _tTapeDelay |
| 633 | { | 494 | { |
| @@ -667,6 +528,49 @@ extern "C" { · 33 unmodified lines | |||
| 667 | 528 | ||
| 668 | //============================================================================== | 529 | //============================================================================== |
| 669 | 530 | ||
| 531 | /*! | ||
| 532 | @defgroup tringbuffer tRingBuffer | ||
| 533 | @ingroup delay | ||
| 534 | @brief | ||
| 535 | @{ | ||
| 536 | |||
| 537 | @fn void tRingBuffer_init (tRingBuffer* const ring, int size) | ||
| 538 | @brief | ||
| 539 | @param | ||
| 540 | |||
| 541 | @fn void tRingBuffer_initToPool (tRingBuffer* const ring, int size, tMempool* const mempool) | ||
| 542 | @brief | ||
| 543 | @param | ||
| 544 | |||
| 545 | @fn void tRingBuffer_free (tRingBuffer* const ring) | ||
| 546 | @brief | ||
| 547 | @param | ||
| 548 | |||
| 549 | @fn void tRingBuffer_push (tRingBuffer* const ring, float val) | ||
| 550 | @brief | ||
| 551 | @param | ||
| 552 | |||
| 553 | @fn float tRingBuffer_getNewest (tRingBuffer* const ring) | ||
| 554 | @brief | ||
| 555 | @param | ||
| 556 | |||
| 557 | @fn float tRingBuffer_getOldest (tRingBuffer* const ring) | ||
| 558 | @brief | ||
| 559 | @param | ||
| 560 | |||
| 561 | @fn float tRingBuffer_get (tRingBuffer* const ring, int index) | ||
| 562 | @brief | ||
| 563 | @param | ||
| 564 | |||
| 565 | @fn float tRingBuffer_clear (tRingBuffer* const ring) | ||
| 566 | @brief | ||
| 567 | @param | ||
| 568 | |||
| 569 | @fn int tRingBuffer_getSize (tRingBuffer* const ring) | ||
| 570 | @brief | ||
| 571 | @param | ||
| 572 |  | ||
| 573 | @} */ | ||
| 670 | typedef struct _tRingBuffer | 574 | typedef struct _tRingBuffer |
| 671 | { | 575 | { |
| 672 | tMempool mempool; | 576 | tMempool mempool; |
| @@ -34,39 +34,28 @@ extern "C" { · 33 unmodified lines | |||
| 34 | @ingroup distortion | 34 | @ingroup distortion |
| 35 | @brief | 35 | @brief |
| 36 | @{ | 36 | @{ |
| 37 | */ | 37 | |
| 38 | |||
| 39 | /*! | ||
| 40 | @fn void tSampleReducer_init (tSampleReducer* const) | 38 | @fn void tSampleReducer_init (tSampleReducer* const) |
| 41 | @brief | 39 | @brief |
| 42 | @param | 40 | @param |
| 43 | */ | 41 | |
| 44 | |||
| 45 | /*! | ||
| 46 | @fn void tSampleReducer_initToPool (tSampleReducer* const, tMempool* const) | 42 | @fn void tSampleReducer_initToPool (tSampleReducer* const, tMempool* const) |
| 47 | @brief | 43 | @brief |
| 48 | @param | 44 | @param |
| 49 | */ | 45 | |
| 50 | |||
| 51 | /*! | ||
| 52 | @fn void tSampleReducer_free (tSampleReducer* const) | 46 | @fn void tSampleReducer_free (tSampleReducer* const) |
| 53 | @brief | 47 | @brief |
| 54 | @param | 48 | @param |
| 55 | */ | 49 | |
| 56 | |||
| 57 | /*! | ||
| 58 | @fn float tSampleReducer_tick (tSampleReducer* const, float input) | 50 | @fn float tSampleReducer_tick (tSampleReducer* const, float input) |
| 59 | @brief | 51 | @brief |
| 60 | @param | 52 | @param |
| 61 | */ | 53 | |
| 62 | |||
| 63 | /*! | ||
| 64 | @fn void tSampleReducer_setRatio (tSampleReducer* const, float ratio) | 54 | @fn void tSampleReducer_setRatio (tSampleReducer* const, float ratio) |
| 65 | @brief | 55 | @brief |
| 66 | @param | 56 | @param |
| 67 | */ | 57 |  |
| 68 | 58 | @} */ | |
| 69 | /*! @} */ | ||
| 70 | 59 | ||
| 71 | typedef struct _tSampleReducer | 60 | typedef struct _tSampleReducer |
| 72 | { | 61 | { |
| @@ -92,51 +81,36 @@ extern "C" { · 19 unmodified lines | |||
| 92 | @ingroup distortion | 81 | @ingroup distortion |
| 93 | @brief | 82 | @brief |
| 94 | @{ | 83 | @{ |
| 95 | */ | 84 | |
| 96 | 85 | @fn void tOversampler_init (tOversampler* const, int order, int extraQuality) | |
| 97 | /*! | ||
| 98 | @fn void tOversampler_init (tOversampler* const, int order, oBool extraQuality) | ||
| 99 | @brief | 86 | @brief |
| 100 | @param | 87 | @param |
| 101 | */ | 88 | |
| 102 | 89 | @fn void tOversampler_initToPool (tOversampler* const, int order, int extraQuality, tMempool* const) | |
| 103 | /*! | ||
| 104 | @fn void tOversampler_initToPool (tOversampler* const, int order, oBool extraQuality, tMempool* const) | ||
| 105 | @brief | 90 | @brief |
| 106 | @param | 91 | @param |
| 107 | */ | 92 | |
| 108 | |||
| 109 | /*! | ||
| 110 | @fn void tOversampler_free (tOversampler* const) | 93 | @fn void tOversampler_free (tOversampler* const) |
| 111 | @brief | 94 | @brief |
| 112 | @param | 95 | @param |
| 113 | */ | 96 | |
| 114 | |||
| 115 | /*! | ||
| 116 | @fn void tOversampler_upsample (tOversampler* const, float input, float* output) | 97 | @fn void tOversampler_upsample (tOversampler* const, float input, float* output) |
| 117 | @brief | 98 | @brief |
| 118 | @param | 99 | @param |
| 119 | */ | 100 | |
| 120 | |||
| 121 | /*! | ||
| 122 | @fn float tOversampler_downsample (tOversampler* const os, float* input) | 101 | @fn float tOversampler_downsample (tOversampler* const os, float* input) |
| 123 | @brief | 102 | @brief |
| 124 | @param | 103 | @param |
| 125 | */ | 104 | |
| 126 | |||
| 127 | /*! | ||
| 128 | @fn float tOversampler_tick (tOversampler* const, float input, float* oversample, float (*effectTick)(float)) | 105 | @fn float tOversampler_tick (tOversampler* const, float input, float* oversample, float (*effectTick)(float)) |
| 129 | @brief | 106 | @brief |
| 130 | @param | 107 | @param |
| 131 | */ | 108 | |
| 132 | |||
| 133 | /*! | ||
| 134 | @fn int tOversampler_getLatency (tOversampler* const os) | 109 | @fn int tOversampler_getLatency (tOversampler* const os) |
| 135 | @brief | 110 | @brief |
| 136 | @param | 111 | @param |
| 137 | */ | 112 |  |
| 138 | 113 | @} */ | |
| 139 | /*! @} */ | ||
| 140 | 114 | ||
| 141 | typedef struct _tOversampler | 115 | typedef struct _tOversampler |
| 142 | { | 116 | { |
| @@ -151,8 +125,8 @@ extern "C" { · 8 unmodified lines | |||
| 151 | 125 | ||
| 152 | typedef _tOversampler* tOversampler; | 126 | typedef _tOversampler* tOversampler; |
| 153 | 127 | ||
| 154 | void tOversampler_init (tOversampler* const, int order, oBool extraQuality); | 128 | void tOversampler_init (tOversampler* const, int order, int extraQuality); |
| 155 | void tOversampler_initToPool (tOversampler* const, int order, oBool extraQuality, tMempool* const); | 129 | void tOversampler_initToPool (tOversampler* const, int order, int extraQuality, tMempool* const); |
| 156 | void tOversampler_free (tOversampler* const); | 130 | void tOversampler_free (tOversampler* const); |
| 157 | 131 | ||
| 158 | void tOversampler_upsample (tOversampler* const, float input, float* output); | 132 | void tOversampler_upsample (tOversampler* const, float input, float* output); |
| @@ -167,33 +141,24 @@ extern "C" { · 8 unmodified lines | |||
| 167 | @ingroup distortion | 141 | @ingroup distortion |
| 168 | @brief | 142 | @brief |
| 169 | @{ | 143 | @{ |
| 170 | */ | 144 | |
| 171 | |||
| 172 | /*! | ||
| 173 | @fn void tLockhartWavefolder_init (tLockhartWavefolder* const) | 145 | @fn void tLockhartWavefolder_init (tLockhartWavefolder* const) |
| 174 | @brief | 146 | @brief |
| 175 | @param | 147 | @param |
| 176 | */ | 148 | |
| 177 | |||
| 178 | /*! | ||
| 179 | @fn void tLockhartWavefolder_initToPool (tLockhartWavefolder* const, tMempool* const) | 149 | @fn void tLockhartWavefolder_initToPool (tLockhartWavefolder* const, tMempool* const) |
| 180 | @brief | 150 | @brief |
| 181 | @param | 151 | @param |
| 182 | */ | 152 | |
| 183 | |||
| 184 | /*! | ||
| 185 | @fn void tLockhartWavefolder_free (tLockhartWavefolder* const) | 153 | @fn void tLockhartWavefolder_free (tLockhartWavefolder* const) |
| 186 | @brief | 154 | @brief |
| 187 | @param | 155 | @param |
| 188 | */ | 156 | |
| 189 | |||
| 190 | /*! | ||
| 191 | @fn float tLockhartWavefolder_tick (tLockhartWavefolder* const, float samp) | 157 | @fn float tLockhartWavefolder_tick (tLockhartWavefolder* const, float samp) |
| 192 | @brief | 158 | @brief |
| 193 | @param | 159 | @param |
| 194 | */ | 160 |  |
| 195 | 161 | @} */ | |
| 196 | /*! @} */ | ||
| 197 | 162 | ||
| 198 | typedef struct _tLockhartWavefolder | 163 | typedef struct _tLockhartWavefolder |
| 199 | { | 164 | { |
| @@ -241,57 +206,40 @@ extern "C" { · 41 unmodified lines | |||
| 241 | @ingroup distortion | 206 | @ingroup distortion |
| 242 | @brief | 207 | @brief |
| 243 | @{ | 208 | @{ |
| 244 | */ | 209 | |
| 245 | |||
| 246 | /*! | ||
| 247 | @fn void tCrusher_init (tCrusher* const) | 210 | @fn void tCrusher_init (tCrusher* const) |
| 248 | @brief | 211 | @brief |
| 249 | @param | 212 | @param |
| 250 | */ | 213 | |
| 251 | |||
| 252 | /*! | ||
| 253 | @fn void tCrusher_initToPool (tCrusher* const, tMempool* const) | 214 | @fn void tCrusher_initToPool (tCrusher* const, tMempool* const) |
| 254 | @brief | 215 | @brief |
| 255 | @param | 216 | @param |
| 256 | */ | 217 | |
| 257 | |||
| 258 | /*! | ||
| 259 | @fn void tCrusher_free (tCrusher* const) | 218 | @fn void tCrusher_free (tCrusher* const) |
| 260 | @brief | 219 | @brief |
| 261 | @param | 220 | @param |
| 262 | */ | 221 | |
| 263 | |||
| 264 | /*! | ||
| 265 | @fn float tCrusher_tick (tCrusher* const, float input) | 222 | @fn float tCrusher_tick (tCrusher* const, float input) |
| 266 | @brief | 223 | @brief |
| 267 | @param | 224 | @param |
| 268 | */ | 225 | |
| 269 | |||
| 270 | /*! | ||
| 271 | @fn void tCrusher_setOperation (tCrusher* const, float op) | 226 | @fn void tCrusher_setOperation (tCrusher* const, float op) |
| 272 | @brief | 227 | @brief |
| 273 | @param 0.0 - 1.0 | 228 | @param 0.0 - 1.0 |
| 274 | */ | 229 | |
| 275 | |||
| 276 | /*! | ||
| 277 | @fn void tCrusher_setQuality (tCrusher* const, float val) | 230 | @fn void tCrusher_setQuality (tCrusher* const, float val) |
| 278 | @brief | 231 | @brief |
| 279 | @param 0.0 - 1.0 | 232 | @param 0.0 - 1.0 |
| 280 | */ | 233 | |
| 281 | |||
| 282 | /*! | ||
| 283 | @fn void tCrusher_setRound (tCrusher* const, float rnd) | 234 | @fn void tCrusher_setRound (tCrusher* const, float rnd) |
| 284 | @brief | 235 | @brief |
| 285 | @param what division to round to | 236 | @param what division to round to |
| 286 | */ | 237 | |
| 287 | |||
| 288 | /*! | ||
| 289 | @fn void tCrusher_setSamplingRatio (tCrusher* const, float ratio) | 238 | @fn void tCrusher_setSamplingRatio (tCrusher* const, float ratio) |
| 290 | @brief | 239 | @brief |
| 291 | @param sampling ratio | 240 | @param sampling ratio |
| 292 | */ | 241 |  |
| 293 | 242 | @} */ | |
| 294 | /*! @} */ | ||
| 295 | 243 | ||
| 296 | typedef struct _tCrusher | 244 | typedef struct _tCrusher |
| 297 | { | 245 | { |
| @@ -36,33 +36,24 @@ extern "C" { · 35 unmodified lines | |||
| 36 | @ingroup dynamics | 36 | @ingroup dynamics |
| 37 | @brief | 37 | @brief |
| 38 | @{ | 38 | @{ |
| 39 | */ | 39 | |
| 40 | |||
| 41 | /*! | ||
| 42 | @fn void tCompressor_init (tCompressor* const) | 40 | @fn void tCompressor_init (tCompressor* const) |
| 43 | @brief | 41 | @brief |
| 44 | @param | 42 | @param |
| 45 | */ | ||
| 46 | 43 | ||
| 47 | /*! | ||
| 48 | @fn void tCompressor_initToPool (tCompressor* const, tMempool* const) | 44 | @fn void tCompressor_initToPool (tCompressor* const, tMempool* const) |
| 49 | @brief | 45 | @brief |
| 50 | @param | 46 | @param |
| 51 | */ | ||
| 52 | 47 | ||
| 53 | /*! | ||
| 54 | @fn void tCompressor_free (tCompressor* const) | 48 | @fn void tCompressor_free (tCompressor* const) |
| 55 | @brief | 49 | @brief |
| 56 | @param | 50 | @param |
| 57 | */ | 51 | |
| 58 | |||
| 59 | /*! | ||
| 60 | @fn float tCompressor_tick (tCompressor* const, float input) | 52 | @fn float tCompressor_tick (tCompressor* const, float input) |
| 61 | @brief | 53 | @brief |
| 62 | @param | 54 | @param |
| 63 | */ | 55 |  |
| 64 | 56 | @} */ | |
| 65 | /*! @} */ | ||
| 66 | 57 | ||
| 67 | typedef struct _tCompressor | 58 | typedef struct _tCompressor |
| 68 | { | 59 | { |
| @@ -73,7 +64,7 @@ extern "C" { · 4 unmodified lines | |||
| 73 | 64 | ||
| 74 | float x_G[2], y_G[2], x_T[2], y_T[2]; | 65 | float x_G[2], y_G[2], x_T[2], y_T[2]; |
| 75 | 66 | ||
| 76 | oBool isActive; | 67 | int isActive; |
| 77 | 68 | ||
| 78 | } _tCompressor; | 69 | } _tCompressor; |
| 79 | 70 | ||
| @@ -89,66 +80,47 @@ extern "C" { · 9 unmodified lines | |||
| 89 | /*! | 80 | /*! |
| 90 | @defgroup tfeedbackleveler tFeedbackLeveler | 81 | @defgroup tfeedbackleveler tFeedbackLeveler |
| 91 | @ingroup dynamics | 82 | @ingroup dynamics |
| 92 | @brief | 83 | @brief An auto VCA that you put into a feedback circuit to make it stay at the same level. |
| 93 | @detail An auto VCA that you put into a feedback circuit to make it stay at the same level. It can enforce level bidirectionally (amplifying and attenuating as needed) or just attenutating. The former option allows for infinite sustain strings, for example, while The latter option allows for decaying strings, which can never exceed a specific level. | 84 | @detail An auto VCA that you put into a feedback circuit to make it stay at the same level. It can enforce level bidirectionally (amplifying and attenuating as needed) or just attenutating. The former option allows for infinite sustain strings, for example, while The latter option allows for decaying strings, which can never exceed a specific level. |
| 94 | @{ | 85 | @{ |
| 95 | */ | 86 | |
| 96 | |||
| 97 | /*! | ||
| 98 | @fn void tFeedbackLeveler_init (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode) | 87 | @fn void tFeedbackLeveler_init (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode) |
| 99 | @brief | 88 | @brief |
| 100 | @param | 89 | @param |
| 101 | */ | 90 | |
| 102 | |||
| 103 | /*! | ||
| 104 | @fn void tFeedbackLeveler_initToPool (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode, tMempool* const) | 91 | @fn void tFeedbackLeveler_initToPool (tFeedbackLeveler* const, float targetLevel, float factor, float strength, int mode, tMempool* const) |
| 105 | @brief | 92 | @brief |
| 106 | @param | 93 | @param |
| 107 | */ | 94 | |
| 108 | |||
| 109 | /*! | ||
| 110 | @fn void tFeedbackLeveler_free (tFeedbackLeveler* const) | 95 | @fn void tFeedbackLeveler_free (tFeedbackLeveler* const) |
| 111 | @brief | 96 | @brief |
| 112 | @param | 97 | @param |
| 113 | */ | 98 | |
| 114 | |||
| 115 | /*! | ||
| 116 | @fn float tFeedbackLeveler_tick (tFeedbackLeveler* const, float input) | 99 | @fn float tFeedbackLeveler_tick (tFeedbackLeveler* const, float input) |
| 117 | @brief | 100 | @brief |
| 118 | @param | 101 | @param |
| 119 | */ | 102 | |
| 120 | |||
| 121 | /*! | ||
| 122 | @fn float tFeedbackLeveler_sample (tFeedbackLeveler* const) | 103 | @fn float tFeedbackLeveler_sample (tFeedbackLeveler* const) |
| 123 | @brief | 104 | @brief |
| 124 | @param | 105 | @param |
| 125 | */ | 106 | |
| 126 | |||
| 127 | /*! | ||
| 128 | @fn void tFeedbackLeveler_setTargetLevel (tFeedbackLeveler* const, float TargetLevel) | 107 | @fn void tFeedbackLeveler_setTargetLevel (tFeedbackLeveler* const, float TargetLevel) |
| 129 | @brief | 108 | @brief |
| 130 | @param | 109 | @param |
| 131 | */ | 110 | |
| 132 | |||
| 133 | /*! | ||
| 134 | @fn void tFeedbackLeveler_setFactor (tFeedbackLeveler* const, float factor) | 111 | @fn void tFeedbackLeveler_setFactor (tFeedbackLeveler* const, float factor) |
| 135 | @brief | 112 | @brief |
| 136 | @param | 113 | @param |
| 137 | */ | 114 | |
| 138 | |||
| 139 | /*! | ||
| 140 | @fn void tFeedbackLeveler_setMode (tFeedbackLeveler* const, int mode) | 115 | @fn void tFeedbackLeveler_setMode (tFeedbackLeveler* const, int mode) |
| 141 | @brief | 116 | @brief |
| 142 | @param | 117 | @param 0 for upwards limiting only, 1 for biderctional limiting |
| 143 | */ // 0 for upwards limiting only, 1 for biderctional limiting | ||
| 144 | 118 | ||
| 145 | /*! | ||
| 146 | @fn void tFeedbackLeveler_setStrength (tFeedbackLeveler* const, float strength) | 119 | @fn void tFeedbackLeveler_setStrength (tFeedbackLeveler* const, float strength) |
| 147 | @brief | 120 | @brief |
| 148 | @param | 121 | @param |
| 149 | */ | 122 |  |
| 150 | 123 | @} */ | |
| 151 | /*! @} */ | ||
| 152 | 124 | ||
| 153 | typedef struct _tFeedbackLeveler | 125 | typedef struct _tFeedbackLeveler |
| 154 | { | 126 | { |
| @@ -183,45 +155,32 @@ extern "C" { · 28 unmodified lines | |||
| 183 | @ingroup dynamics | 155 | @ingroup dynamics |
| 184 | @brief Threshold with hysteresis (like Max/MSP thresh~ object) | 156 | @brief Threshold with hysteresis (like Max/MSP thresh~ object) |
| 185 | @{ | 157 | @{ |
| 186 | */ | 158 | |
| 187 | |||
| 188 | /*! | ||
| 189 | @fn void tThreshold_init (tThreshold* const, float low, float high) | 159 | @fn void tThreshold_init (tThreshold* const, float low, float high) |
| 190 | @brief | 160 | @brief |
| 191 | @param | 161 | @param |
| 192 | */ | ||
| 193 | 162 | ||
| 194 | /*! | ||
| 195 | @fn void tThreshold_initToPool (tThreshold* const, float low, float high, tMempool* const) | 163 | @fn void tThreshold_initToPool (tThreshold* const, float low, float high, tMempool* const) |
| 196 | @brief | 164 | @brief |
| 197 | @param | 165 | @param |
| 198 | */ | ||
| 199 | 166 | ||
| 200 | /*! | ||
| 201 | @fn void tThreshold_free (tThreshold* const) | 167 | @fn void tThreshold_free (tThreshold* const) |
| 202 | @brief | 168 | @brief |
| 203 | @param | 169 | @param |
| 204 | */ | 170 | |
| 205 | |||
| 206 | /*! | ||
| 207 | @fn int tThreshold_tick (tThreshold* const, float input) | 171 | @fn int tThreshold_tick (tThreshold* const, float input) |
| 208 | @brief | 172 | @brief |
| 209 | @param | 173 | @param |
| 210 | */ | ||
| 211 | 174 | ||
| 212 | /*! | ||
| 213 | @fn void tThreshold_setLow (tThreshold* const, float low) | 175 | @fn void tThreshold_setLow (tThreshold* const, float low) |
| 214 | @brief | 176 | @brief |
| 215 | @param | 177 | @param |
| 216 | */ | ||
| 217 | 178 | ||
| 218 | /*! | ||
| 219 | @fn void tThreshold_setHigh (tThreshold* const, float high) | 179 | @fn void tThreshold_setHigh (tThreshold* const, float high) |
| 220 | @brief | 180 | @brief |
| 221 | @param | 181 | @param |
| 222 | */ | 182 | |
| 223 | 183 | @} */ | |
| 224 | /*! @} */ | ||
| 225 | 184 | ||
| 226 | typedef struct _tThreshold | 185 | typedef struct _tThreshold |
| 227 | { | 186 | { |
| @@ -24,7 +24,70 @@ extern "C" { · 23 unmodified lines | |||
| 24 | 24 | ||
| 25 | //============================================================================== | 25 | //============================================================================== |
| 26 | 26 | ||
| 27 | /* tTalkbox */ | 27 | /*! |
| 28 | @defgroup ttalkbox tTalkbox | ||
| 29 | @ingroup effects | ||
| 30 | @brief | ||
| 31 | @{ | ||
| 32 | |||
| 33 | @fn void tTalkbox_init (tTalkbox* const, int bufsize) | ||
| 34 | @brief | ||
| 35 | @param | ||
| 36 | |||
| 37 | @fn void tTalkbox_initToPool (tTalkbox* const, int bufsize, tMempool* const) | ||
| 38 | @brief | ||
| 39 | @param | ||
| 40 | |||
| 41 | @fn void tTalkbox_free (tTalkbox* const) | ||
| 42 | @brief | ||
| 43 | @param | ||
| 44 | |||
| 45 | @fn float tTalkbox_tick (tTalkbox* const, float synth, float voice) | ||
| 46 | @brief | ||
| 47 | @param | ||
| 48 | |||
| 49 | @fn float tTalkbox_tickFrozen (tTalkbox* const voc, float synth, float voice) | ||
| 50 | @brief | ||
| 51 | @param | ||
| 52 | |||
| 53 | @fn void tTalkbox_update (tTalkbox* const) | ||
| 54 | @brief | ||
| 55 | @param | ||
| 56 | |||
| 57 | @fn void tTalkbox_suspend (tTalkbox* const) | ||
| 58 | @brief | ||
| 59 | @param | ||
| 60 | |||
| 61 | @fn void tTalkbox_lpcDurbin (float *r, int p, float *k, float *g) | ||
| 62 | @brief | ||
| 63 | @param | ||
| 64 | |||
| 65 | @fn void tTalkbox_lpc (float *buf, float *car, double* dl, double* Rt, int32_t n, int32_t o, float warp, int warpOn, float *k, int freeze, float *G) | ||
| 66 | @brief | ||
| 67 | @param | ||
| 68 | |||
| 69 | @fn void tTalkbox_setQuality (tTalkbox* const, float quality) | ||
| 70 | @brief | ||
| 71 | @param | ||
| 72 | |||
| 73 | @fn void tTalkbox_setWarpFactor (tTalkbox* const voc, float warp) | ||
| 74 | @brief | ||
| 75 | @param | ||
| 76 | |||
| 77 | @fn void tTalkbox_setWarpOn (tTalkbox* const voc, float warpOn) | ||
| 78 | @brief | ||
| 79 | @param | ||
| 80 | |||
| 81 | @fn void tTalkbox_setFreeze (tTalkbox* const voc, float freeze) | ||
| 82 | @brief | ||
| 83 | @param | ||
| 84 | |||
| 85 | @fn void tTalkbox_warpedAutocorrelate (float * x, double* dl, double* Rt, unsigned int L, float * R, unsigned int P, float lambda) | ||
| 86 | @brief | ||
| 87 | @param | ||
| 88 | |||
| 89 | @} */ | ||
| 90 | |||
| 28 | #define NUM_TALKBOX_PARAM 4 | 91 | #define NUM_TALKBOX_PARAM 4 |
| 29 | 92 | ||
| 30 | typedef struct _tTalkbox | 93 | typedef struct _tTalkbox |
| @@ -72,10 +135,74 @@ extern "C" { · 41 unmodified lines | |||
| 72 | void tTalkbox_setWarpOn (tTalkbox* const voc, float warpOn); | 135 | void tTalkbox_setWarpOn (tTalkbox* const voc, float warpOn); |
| 73 | void tTalkbox_setFreeze (tTalkbox* const voc, float freeze); | 136 | void tTalkbox_setFreeze (tTalkbox* const voc, float freeze); |
| 74 | void tTalkbox_warpedAutocorrelate (float * x, double* dl, double* Rt, unsigned int L, float * R, unsigned int P, float lambda); | 137 | void tTalkbox_warpedAutocorrelate (float * x, double* dl, double* Rt, unsigned int L, float * R, unsigned int P, float lambda); |
| 138 | |||
| 139 | |||
| 75 | //============================================================================== | 140 | //============================================================================== |
| 76 | 141 | ||
| 77 | 142 | ||
| 78 | /////// | 143 | /*! |
| 144 | @defgroup ttalkboxfloat tTalkboxFloat | ||
| 145 | @ingroup effects | ||
| 146 | @brief | ||
| 147 | @{ | ||
| 148 | |||
| 149 | @fn void tTalkboxFloat_init (tTalkboxFloat* const, int bufsize) | ||
| 150 | @brief | ||
| 151 | @param | ||
| 152 | |||
| 153 | @fn void tTalkboxFloat_initToPool (tTalkboxFloat* const, int bufsize, tMempool* const) | ||
| 154 | @brief | ||
| 155 | @param | ||
| 156 | |||
| 157 | @fn void tTalkboxFloat_free (tTalkboxFloat* const) | ||
| 158 | @brief | ||
| 159 | @param | ||
| 160 | |||
| 161 | @fn float tTalkboxFloat_tick (tTalkboxFloat* const, float synth, float voice) | ||
| 162 | @brief | ||
| 163 | @param | ||
| 164 | |||
| 165 | @fn float tTalkboxFloat_tickFrozen (tTalkboxFloat* const voc, float synth, float voice) | ||
| 166 | @brief | ||
| 167 | @param | ||
| 168 | |||
| 169 | @fn void tTalkboxFloat_update (tTalkboxFloat* const) | ||
| 170 | @brief | ||
| 171 | @param | ||
| 172 | |||
| 173 | @fn void tTalkboxFloat_suspend (tTalkboxFloat* const) | ||
| 174 | @brief | ||
| 175 | @param | ||
| 176 | |||
| 177 | @fn void tTalkboxFloat_lpcDurbin (float *r, int p, float *k, float *g) | ||
| 178 | @brief | ||
| 179 | @param | ||
| 180 | |||
| 181 | @fn void tTalkboxFloat_lpc (float *buf, float *car, float* dl, float* Rt, int32_t n, int32_t o, float warp, int warpOn, float *k, int freeze, float *G) | ||
| 182 | @brief | ||
| 183 | @param | ||
| 184 | |||
| 185 | @fn void tTalkboxFloat_setQuality (tTalkboxFloat* const, float quality) | ||
| 186 | @brief | ||
| 187 | @param | ||
| 188 | |||
| 189 | @fn void tTalkboxFloat_setWarpFactor (tTalkboxFloat* const voc, float warp) | ||
| 190 | @brief | ||
| 191 | @param | ||
| 192 | |||
| 193 | @fn void tTalkboxFloat_setWarpOn (tTalkboxFloat* const voc, float warpOn) | ||
| 194 | @brief | ||
| 195 | @param | ||
| 196 | |||
| 197 | @fn void tTalkboxFloat_setFreeze (tTalkboxFloat* const voc, float freeze) | ||
| 198 | @brief | ||
| 199 | @param | ||
| 200 | |||
| 201 | @fn void tTalkboxFloat_warpedAutocorrelate (float * x, float* dl, float* Rt, unsigned int L, float * R, unsigned int P, float lambda) | ||
| 202 | @brief | ||
| 203 | @param | ||
| 204 | |||
| 205 | @} */ | ||
| 79 | 206 | ||
| 80 | typedef struct _tTalkboxFloat | 207 | typedef struct _tTalkboxFloat |
| 81 | { | 208 | { |
| @@ -102,7 +229,6 @@ extern "C" { · 20 unmodified lines | |||
| 102 | float* dl; | 229 | float* dl; |
| 103 | float* Rt; | 230 | float* Rt; |
| 104 | 231 | ||
| 105 | |||
| 106 | } _tTalkboxFloat; | 232 | } _tTalkboxFloat; |
| 107 | 233 | ||
| 108 | typedef _tTalkboxFloat* tTalkboxFloat; | 234 | typedef _tTalkboxFloat* tTalkboxFloat; |
| @@ -125,8 +251,38 @@ extern "C" { · 16 unmodified lines | |||
| 125 | //============================================================================== | 251 | //============================================================================== |
| 126 | 252 | ||
| 127 | 253 | ||
| 128 | 254 | /*! | |
| 129 | /* tVocoder */ | 255 | @defgroup tvocoder tVocoder |
| 256 | @ingroup effects | ||
| 257 | @brief | ||
| 258 | @{ | ||
| 259 | |||
| 260 | @fn void tVocoder_init (tVocoder* const) | ||
| 261 | @brief | ||
| 262 | @param | ||
| 263 | |||
| 264 | @fn void tVocoder_initToPool (tVocoder* const, tMempool* const) | ||
| 265 | @brief | ||
| 266 | @param | ||
| 267 | |||
| 268 | @fn void tVocoder_free (tVocoder* const) | ||
| 269 | @brief | ||
| 270 | @param | ||
| 271 | |||
| 272 | @fn float tVocoder_tick (tVocoder* const, float synth, float voice) | ||
| 273 | @brief | ||
| 274 | @param | ||
| 275 | |||
| 276 | @fn void tVocoder_update (tVocoder* const) | ||
| 277 | @brief | ||
| 278 | @param | ||
| 279 | |||
| 280 | @fn void tVocoder_suspend (tVocoder* const) | ||
| 281 | @brief | ||
| 282 | @param | ||
| 283 | |||
| 284 | @} */ | ||
| 285 | |||
| 130 | #define NUM_VOCODER_PARAM 8 | 286 | #define NUM_VOCODER_PARAM 8 |
| 131 | #define NBANDS 16 | 287 | #define NBANDS 16 |
| 132 | 288 | ||
| @@ -159,7 +315,49 @@ extern "C" { · 26 unmodified lines | |||
| 159 | 315 | ||
| 160 | //============================================================================== | 316 | //============================================================================== |
| 161 | 317 | ||
| 162 | // tRosenbergGlottalPulse | 318 | /*! |
| 319 | @defgroup trosenbergglottalpulse tRosenbergGlottalPulse | ||
| 320 | @ingroup effects | ||
| 321 | @brief | ||
| 322 | @{ | ||
| 323 | |||
| 324 | @fn void tRosenbergGlottalPulse_init (tRosenbergGlottalPulse* const) | ||
| 325 | @brief | ||
| 326 | @param | ||
| 327 | |||
| 328 | @fn void tRosenbergGlottalPulse_initToPool (tRosenbergGlottalPulse* const, tMempool* const) | ||
| 329 | @brief | ||
| 330 | @param | ||
| 331 | |||
| 332 | @fn void tRosenbergGlottalPulse_free (tRosenbergGlottalPulse* const) | ||
| 333 | @brief | ||
| 334 | @param | ||
| 335 | |||
| 336 | @fn float tRosenbergGlottalPulse_tick (tRosenbergGlottalPulse* const) | ||
| 337 | @brief | ||
| 338 | @param | ||
| 339 | |||
| 340 | @fn float tRosenbergGlottalPulse_tickHQ (tRosenbergGlottalPulse* const gp) | ||
| 341 | @brief | ||
| 342 | @param | ||
| 343 | |||
| 344 | @fn void tRosenbergGlottalPulse_setFreq (tRosenbergGlottalPulse* const, float freq) | ||
| 345 | @brief | ||
| 346 | @param | ||
| 347 | |||
| 348 | @fn void tRosenbergGlottalPulse_setOpenLength (tRosenbergGlottalPulse* const, float openLength) | ||
| 349 | @brief | ||
| 350 | @param | ||
| 351 | |||
| 352 | @fn void tRosenbergGlottalPulse_setPulseLength (tRosenbergGlottalPulse* const, float pulseLength) | ||
| 353 | @brief | ||
| 354 | @param | ||
| 355 | |||
| 356 | @fn void tRosenbergGlottalPulse_setOpenLengthAndPulseLength (tRosenbergGlottalPulse* const gp, float openLength, float pulseLength) | ||
| 357 | @brief | ||
| 358 | @param | ||
| 359 | |||
| 360 | @} */ | ||
| 163 | 361 | ||
| 164 | typedef struct _tRosenbergGlottalPulse | 362 | typedef struct _tRosenbergGlottalPulse |
| 165 | { | 363 | { |
| @@ -188,10 +386,46 @@ extern "C" { · 22 unmodified lines | |||
| 188 | void tRosenbergGlottalPulse_setOpenLengthAndPulseLength (tRosenbergGlottalPulse* const gp, float openLength, float pulseLength); | 386 | void tRosenbergGlottalPulse_setOpenLengthAndPulseLength (tRosenbergGlottalPulse* const gp, float openLength, float pulseLength); |
| 189 | //============================================================================== | 387 | //============================================================================== |
| 190 | 388 | ||
| 191 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 389 | /*! |
| 390 | @defgroup tsolad tSOLAD | ||
| 391 | @ingroup effects | ||
| 392 | @brief pitch shifting algorithm that underlies tRetune etc from Katja Vetters http://www.katjaas.nl/pitchshiftlowlatency/pitchshiftlowlatency.html | ||
| 393 | @{ | ||
| 394 | |||
| 395 | @fn void tSOLAD_init (tSOLAD* const) | ||
| 396 | @brief | ||
| 397 | @param | ||
| 398 | |||
| 399 | @fn void tSOLAD_initToPool (tSOLAD* const, tMempool* const) | ||
| 400 | @brief | ||
| 401 | @param | ||
| 402 | |||
| 403 | @fn void tSOLAD_free (tSOLAD* const) | ||
| 404 | @brief | ||
| 405 | @param | ||
| 406 | |||
| 407 | @fn void tSOLAD_ioSamples (tSOLAD *w, float* in, float* out, int blocksize) | ||
| 408 | @brief send one block of input samples, receive one block of output samples | ||
| 409 | @param | ||
| 410 | |||
| 411 | @fn void tSOLAD_setPeriod (tSOLAD *w, float period) | ||
| 412 | @brief set periodicity analysis data | ||
| 413 | @param | ||
| 414 | |||
| 415 | @fn void tSOLAD_setPitchFactor (tSOLAD *w, float pitchfactor) | ||
| 416 | @brief set pitch factor between 0.25 and 4 | ||
| 417 | @param | ||
| 418 | |||
| 419 | @fn void tSOLAD_setReadLag (tSOLAD *w, float readlag) | ||
| 420 | @brief force readpointer lag | ||
| 421 | @param | ||
| 422 | |||
| 423 | @fn void tSOLAD_resetState (tSOLAD *w) | ||
| 424 | @brief reset state variables | ||
| 425 | @param | ||
| 426 | |||
| 427 | @} */ | ||
| 192 | 428 | ||
| 193 | /* tSOLAD : pitch shifting algorithm that underlies tRetune etc */ | ||
| 194 | // from Katja Vetters http://www.katjaas.nl/pitchshiftlowlatency/pitchshiftlowlatency.html | ||
| 195 | #define LOOPSIZE (2048*2) // (4096*2) // loop size must be power of two | 429 | #define LOOPSIZE (2048*2) // (4096*2) // loop size must be power of two |
| 196 | #define LOOPMASK (LOOPSIZE - 1) | 430 | #define LOOPMASK (LOOPSIZE - 1) |
| 197 | #define PITCHFACTORDEFAULT 1.0f | 431 | #define PITCHFACTORDEFAULT 1.0f |
| @@ -233,7 +467,42 @@ extern "C" { · 35 unmodified lines | |||
| 233 | // reset state variables | 467 | // reset state variables |
| 234 | void tSOLAD_resetState (tSOLAD *w); | 468 | void tSOLAD_resetState (tSOLAD *w); |
| 235 | 469 | ||
| 236 | // Pitch shift | 470 | /*! |
| 471 | @defgroup tpitchshift tPitchShift | ||
| 472 | @ingroup effects | ||
| 473 | @brief | ||
| 474 | @{ | ||
| 475 | |||
| 476 | @fn void tPitchShift_init (tPitchShift* const, tPeriodDetection* const, float* out, int bufSize) | ||
| 477 | @brief | ||
| 478 | @param | ||
| 479 | |||
| 480 | @fn void tPitchShift_initToPool (tPitchShift* const, tPeriodDetection* const, float* out, int bufSize, tMempool* const) | ||
| 481 | @brief | ||
| 482 | @param | ||
| 483 | |||
| 484 | @fn void tPitchShift_free (tPitchShift* const) | ||
| 485 | @brief | ||
| 486 | @param | ||
| 487 | |||
| 488 | @fn float tPitchShift_shift (tPitchShift* const) | ||
| 489 | @brief | ||
| 490 | @param | ||
| 491 | |||
| 492 | @fn float tPitchShift_shiftToFunc (tPitchShift* const, float (*fun)(float)) | ||
| 493 | @brief | ||
| 494 | @param | ||
| 495 | |||
| 496 | @fn float tPitchShift_shiftToFreq (tPitchShift* const, float freq) | ||
| 497 | @brief | ||
| 498 | @param | ||
| 499 | |||
| 500 | @fn void tPitchShift_setPitchFactor (tPitchShift* const, float pf) | ||
| 501 | @brief | ||
| 502 | @param | ||
| 503 | |||
| 504 | @} */ | ||
| 505 | |||
| 237 | typedef struct _tPitchShift | 506 | typedef struct _tPitchShift |
| 238 | { | 507 | { |
| 239 | tMempool mempool; | 508 | tMempool mempool; |
| @@ -267,7 +536,66 @@ extern "C" { · 27 unmodified lines | |||
| 267 | float tPitchShift_shiftToFreq (tPitchShift* const, float freq); | 536 | float tPitchShift_shiftToFreq (tPitchShift* const, float freq); |
| 268 | void tPitchShift_setPitchFactor (tPitchShift* const, float pf); | 537 | void tPitchShift_setPitchFactor (tPitchShift* const, float pf); |
| 269 | 538 | ||
| 270 | // Retune | 539 | /*! |
| 540 | @defgroup tretune tRetune | ||
| 541 | @ingroup effects | ||
| 542 | @brief | ||
| 543 | @{ | ||
| 544 | |||
| 545 | @fn void tRetune_init (tRetune* const, int numVoices, int bufSize, int frameSize) | ||
| 546 | @brief | ||
| 547 | @param | ||
| 548 | |||
| 549 | @fn void tRetune_initToPool (tRetune* const, int numVoices, int bufSize, int frameSize, tMempool* const) | ||
| 550 | @brief | ||
| 551 | @param | ||
| 552 | |||
| 553 | @fn void tRetune_free (tRetune* const) | ||
| 554 | @brief | ||
| 555 | @param | ||
| 556 | |||
| 557 | @fn float* tRetune_tick (tRetune* const, float sample) | ||
| 558 | @brief | ||
| 559 | @param | ||
| 560 | |||
| 561 | @fn void tRetune_setNumVoices (tRetune* const, int numVoices) | ||
| 562 | @brief | ||
| 563 | @param | ||
| 564 | |||
| 565 | @fn void tRetune_setPitchFactors (tRetune* const, float pf) | ||
| 566 | @brief | ||
| 567 | @param | ||
| 568 | |||
| 569 | @fn void tRetune_setPitchFactor (tRetune* const, float pf, int voice) | ||
| 570 | @brief | ||
| 571 | @param | ||
| 572 | |||
| 573 | @fn void tRetune_setTimeConstant (tRetune* const, float tc) | ||
| 574 | @brief | ||
| 575 | @param | ||
| 576 | |||
| 577 | @fn void tRetune_setHopSize (tRetune* const, int hs) | ||
| 578 | @brief | ||
| 579 | @param | ||
| 580 | |||
| 581 | @fn void tRetune_setWindowSize (tRetune* const, int ws) | ||
| 582 | @brief | ||
| 583 | @param | ||
| 584 | |||
| 585 | @fn void tRetune_setFidelityThreshold(tRetune* const, float threshold) | ||
| 586 | @brief | ||
| 587 | @param | ||
| 588 | |||
| 589 | @fn float tRetune_getInputPeriod (tRetune* const) | ||
| 590 | @brief | ||
| 591 | @param | ||
| 592 | |||
| 593 | @fn float tRetune_getInputFreq (tRetune* const) | ||
| 594 | @brief | ||
| 595 | @param | ||
| 596 | |||
| 597 | @} */ | ||
| 598 | |||
| 271 | typedef struct _tRetune | 599 | typedef struct _tRetune |
| 272 | { | 600 | { |
| 273 | tMempool mempool; | 601 | tMempool mempool; |
| @@ -311,7 +639,74 @@ extern "C" { · 37 unmodified lines | |||
| 311 | float tRetune_getInputPeriod (tRetune* const); | 639 | float tRetune_getInputPeriod (tRetune* const); |
| 312 | float tRetune_getInputFreq (tRetune* const); | 640 | float tRetune_getInputFreq (tRetune* const); |
| 313 | 641 | ||
| 314 | // Autotune | 642 | /*! |
| 643 | @defgroup tautotune tAutotune | ||
| 644 | @ingroup effects | ||
| 645 | @brief | ||
| 646 | @{ | ||
| 647 | |||
| 648 | @fn void tAutotune_init (tAutotune* const, int numVoices, int bufSize, int frameSize) | ||
| 649 | @brief | ||
| 650 | @param | ||
| 651 | |||
| 652 | @fn void tAutotune_initToPool (tAutotune* const, int numVoices, int bufSize, int frameSize, tMempool* const) | ||
| 653 | @brief | ||
| 654 | @param | ||
| 655 | |||
| 656 | @fn void tAutotune_free (tAutotune* const) | ||
| 657 | @brief | ||
| 658 | @param | ||
| 659 | |||
| 660 | @fn float* tAutotune_tick (tAutotune* const, float sample) | ||
| 661 | @brief | ||
| 662 | @param | ||
| 663 | |||
| 664 | @fn void tAutotune_setNumVoices (tAutotune* const, int numVoices) | ||
| 665 | @brief | ||
| 666 | @param | ||
| 667 | |||
| 668 | @fn void tAutotune_setFreqs (tAutotune* const, float f) | ||
| 669 | @brief | ||
| 670 | @param | ||
| 671 | |||
| 672 | @fn void tAutotune_setFreq (tAutotune* const, float f, int voice) | ||
| 673 | @brief | ||
| 674 | @param | ||
| 675 | |||
| 676 | @fn void tAutotune_setTimeConstant (tAutotune* const, float tc) | ||
| 677 | @brief | ||
| 678 | @param | ||
| 679 | |||
| 680 | @fn void tAutotune_setHopSize (tAutotune* const, int hs) | ||
| 681 | @brief | ||
| 682 | @param | ||
| 683 | |||
| 684 | @fn void tAutotune_setWindowSize (tAutotune* const, int ws) | ||
| 685 | @brief | ||
| 686 | @param | ||
| 687 | |||
| 688 | @fn void tAutotune_setFidelityThreshold (tAutotune* const, float threshold) | ||
| 689 | @brief | ||
| 690 | @param | ||
| 691 | |||
| 692 | @fn void tAutotune_setAlpha (tAutotune* const, float alpha) | ||
| 693 | @brief | ||
| 694 | @param | ||
| 695 | |||
| 696 | @fn void tAutotune_setTolerance (tAutotune* const, float tolerance) | ||
| 697 | @brief | ||
| 698 | @param | ||
| 699 | |||
| 700 | @fn float tAutotune_getInputPeriod (tAutotune* const) | ||
| 701 | @brief | ||
| 702 | @param | ||
| 703 | |||
| 704 | @fn float tAutotune_getInputFreq (tAutotune* const) | ||
| 705 | @brief | ||
| 706 | @param | ||
| 707 | |||
| 708 | @} */ | ||
| 709 | |||
| 315 | typedef struct _tAutotune | 710 | typedef struct _tAutotune |
| 316 | { | 711 | { |
| 317 | tMempool mempool; | 712 | tMempool mempool; |
| @@ -359,6 +754,49 @@ extern "C" { · 41 unmodified lines | |||
| 359 | 754 | ||
| 360 | //============================================================================== | 755 | //============================================================================== |
| 361 | 756 | ||
| 757 | /*! | ||
| 758 | @defgroup tformantshifter tFormantShifter | ||
| 759 | @ingroup effects | ||
| 760 | @brief | ||
| 761 | @{ | ||
| 762 | |||
| 763 | @fn void tFormantShifter_init (tFormantShifter* const, int order) | ||
| 764 | @brief | ||
| 765 | @param | ||
| 766 | |||
| 767 | @fn void tFormantShifter_initToPool (tFormantShifter* const, int order, tMempool* const) | ||
| 768 | @brief | ||
| 769 | @param | ||
| 770 | |||
| 771 | @fn void tFormantShifter_free (tFormantShifter* const) | ||
| 772 | @brief | ||
| 773 | @param | ||
| 774 | |||
| 775 | @fn float tFormantShifter_tick (tFormantShifter* const, float input) | ||
| 776 | @brief | ||
| 777 | @param | ||
| 778 | |||
| 779 | @fn float tFormantShifter_remove (tFormantShifter* const, float input) | ||
| 780 | @brief | ||
| 781 | @param | ||
| 782 | |||
| 783 | @fn float tFormantShifter_add (tFormantShifter* const, float input) | ||
| 784 | @brief | ||
| 785 | @param | ||
| 786 | |||
| 787 | @fn void tFormantShifter_ioSamples (tFormantShifter* const, float* in, float* out, int size, float fwarp) | ||
| 788 | @brief | ||
| 789 | @param | ||
| 790 | |||
| 791 | @fn void tFormantShifter_setShiftFactor (tFormantShifter* const, float shiftFactor) | ||
| 792 | @brief | ||
| 793 | @param | ||
| 794 | |||
| 795 | @fn void tFormantShifter_setIntensity (tFormantShifter* const, float intensity) | ||
| 796 | @brief | ||
| 797 | @param | ||
| 798 | |||
| 799 | @} */ | ||
| 362 | 800 | ||
| 363 | typedef struct _tFormantShifter | 801 | typedef struct _tFormantShifter |
| 364 | { | 802 | { |
| @@ -28,6 +28,66 @@ extern "C" { · 27 unmodified lines | |||
| 28 | 28 | ||
| 29 | //============================================================================== | 29 | //============================================================================== |
| 30 | 30 | ||
| 31 | /*! | ||
| 32 | @defgroup twdf tWDF | ||
| 33 | @ingroup electrical | ||
| 34 | @brief | ||
| 35 | @{ | ||
| 36 | |||
| 37 | @fn void tWDF_init (tWDF* const, WDFComponentType type, float value, tWDF* const rL, tWDF* const rR) | ||
| 38 | @brief | ||
| 39 | @param | ||
| 40 | |||
| 41 | @fn void tWDF_initToPool (tWDF* const, WDFComponentType type, float value, tWDF* const rL, tWDF* const rR, tMempool* const) | ||
| 42 | @brief | ||
| 43 | @param | ||
| 44 | |||
| 45 | @fn void tWDF_free (tWDF* const) | ||
| 46 | @brief | ||
| 47 | @param | ||
| 48 | |||
| 49 | @fn float tWDF_tick (tWDF* const, float sample, tWDF* const outputPoint, uint8_t paramsChanged) | ||
| 50 | @brief | ||
| 51 | @param | ||
| 52 | |||
| 53 | @fn void tWDF_setValue (tWDF* const, float value) | ||
| 54 | @brief | ||
| 55 | @param | ||
| 56 | |||
| 57 | @fn void tWDF_setSampleRate (tWDF* const, float sample_rate) | ||
| 58 | @brief | ||
| 59 | @param | ||
| 60 | |||
| 61 | @fn uint8_t tWDF_isLeaf (tWDF* const) | ||
| 62 | @brief | ||
| 63 | @param | ||
| 64 | |||
| 65 | @fn float tWDF_getPortResistance (tWDF* const) | ||
| 66 | @brief | ||
| 67 | @param | ||
| 68 | |||
| 69 | @fn float tWDF_getReflectedWaveUp (tWDF* const, float input) | ||
| 70 | @brief | ||
| 71 | @param | ||
| 72 | |||
| 73 | @fn float tWDF_getReflectedWaveDown (tWDF* const, float input, float incident_wave) | ||
| 74 | @brief | ||
| 75 | @param | ||
| 76 | |||
| 77 | @fn void tWDF_setIncidentWave (tWDF* const, float incident_wave, float input) | ||
| 78 | @brief | ||
| 79 | @param | ||
| 80 | |||
| 81 | @fn float tWDF_getVoltage (tWDF* const) | ||
| 82 | @brief | ||
| 83 | @param | ||
| 84 | |||
| 85 | @fn float tWDF_getCurrent (tWDF* const) | ||
| 86 | @brief | ||
| 87 | @param | ||
| 88 | |||
| 89 | @} */ | ||
| 90 | |||
| 31 | typedef enum WDFComponentType | 91 | typedef enum WDFComponentType |
| 32 | { | 92 | { |
| 33 | SeriesAdaptor = 0, | 93 | SeriesAdaptor = 0, |
| @@ -31,10 +31,49 @@ extern "C" { · 30 unmodified lines | |||
| 31 | * @example basic-oscillators.c | 31 | * @example basic-oscillators.c |
| 32 | * An example. | 32 | * An example. |
| 33 | */ | 33 | */ |
| 34 | 34 | ||
| 35 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 35 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 36 | 36 | ||
| 37 | /* Attack-Decay envelope */ | 37 | /*! |
| 38 | @defgroup tenvelope tEnvelope | ||
| 39 | @ingroup envelopes | ||
| 40 | @brief Attack-decay envelope. | ||
| 41 | @{ | ||
| 42 | |||
| 43 | @fn void tEnvelope_init (tEnvelope* const, float attack, float decay, int loop) | ||
| 44 | @brief | ||
| 45 | @param | ||
| 46 | |||
| 47 | @fn void tEnvelope_initToPool (tEnvelope* const, float attack, float decay, int loop, tMempool* const) | ||
| 48 | @brief | ||
| 49 | @param | ||
| 50 | |||
| 51 | @fn void tEnvelope_free (tEnvelope* const) | ||
| 52 | @brief | ||
| 53 | @param | ||
| 54 | |||
| 55 | @fn float tEnvelope_tick (tEnvelope* const) | ||
| 56 | @brief | ||
| 57 | @param | ||
| 58 | |||
| 59 | @fn void tEnvelope_setAttack (tEnvelope* const, float attack) | ||
| 60 | @brief | ||
| 61 | @param | ||
| 62 | |||
| 63 | @fn void tEnvelope_setDecay (tEnvelope* const, float decay) | ||
| 64 | @brief | ||
| 65 | @param | ||
| 66 | |||
| 67 | @fn void tEnvelope_loop (tEnvelope* const, int loop) | ||
| 68 | @brief | ||
| 69 | @param | ||
| 70 | |||
| 71 | @fn void tEnvelope_on (tEnvelope* const, float velocity) | ||
| 72 | @brief | ||
| 73 | @param | ||
| 74 | |||
| 75 | @} */ | ||
| 76 | |||
| 38 | typedef struct _tEnvelope | 77 | typedef struct _tEnvelope |
| 39 | { | 78 | { |
| 40 | tMempool mempool; | 79 | tMempool mempool; |
| @@ -71,216 +110,498 @@ extern "C" { · 30 unmodified lines | |||
| 71 | 110 | ||
| 72 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 111 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 73 | 112 | ||
| 74 | 113 | ||
| 75 | 114 | /*! | |
| 76 | /* Exponential Smoother */ | 115 | @defgroup texpsmooth tExpSmooth |
| 116 | @ingroup envelopes | ||
| 117 | @brief | ||
| 118 | @{ | ||
| 119 | |||
| 120 | @fn void tExpSmooth_init (tExpSmooth* const, float val, float factor) | ||
| 121 | @brief | ||
| 122 | @param | ||
| 123 | |||
| 124 | @fn void tExpSmooth_initToPool (tExpSmooth* const, float val, float factor, tMempool* const) | ||
| 125 | @brief | ||
| 126 | @param | ||
| 127 | |||
| 128 | @fn void tExpSmooth_free (tExpSmooth* const) | ||
| 129 | @brief | ||
| 130 | @param | ||
| 131 | |||
| 132 | @fn float tExpSmooth_tick (tExpSmooth* const) | ||
| 133 | @brief | ||
| 134 | @param | ||
| 135 | |||
| 136 | @fn float tExpSmooth_sample (tExpSmooth* const) | ||
| 137 | @brief | ||
| 138 | @param | ||
| 139 | |||
| 140 | @fn void tExpSmooth_setFactor (tExpSmooth* const, float factor) | ||
| 141 | @brief | ||
| 142 | @param | ||
| 143 | |||
| 144 | @fn void tExpSmooth_setDest (tExpSmooth* const, float dest) | ||
| 145 | @brief | ||
| 146 | @param | ||
| 147 | |||
| 148 | @fn void tExpSmooth_setVal (tExpSmooth* const, float val) | ||
| 149 | @brief | ||
| 150 | @param | ||
| 151 | |||
| 152 | @fn void tExpSmooth_setValAndDest(tExpSmooth* const expsmooth, float val) | ||
| 153 | @brief | ||
| 154 | @param | ||
| 155 | |||
| 156 | @} */ | ||
| 157 | |||
| 77 | typedef struct _tExpSmooth | 158 | typedef struct _tExpSmooth |
| 78 | { | 159 | { |
| 79 | tMempool mempool; | 160 | tMempool mempool; |
| 80 | float factor, oneminusfactor; | 161 | float factor, oneminusfactor; |
| 81 | float curr,dest; | 162 | float curr,dest; |
| 82 | } _tExpSmooth; | 163 | } _tExpSmooth; |
| 83 | 164 | ||
| 84 | typedef _tExpSmooth* tExpSmooth; | 165 | typedef _tExpSmooth* tExpSmooth; |
| 85 | 166 | ||
| 86 | void tExpSmooth_init (tExpSmooth* const, float val, float factor); | 167 | void tExpSmooth_init (tExpSmooth* const, float val, float factor); |
| 87 | void tExpSmooth_initToPool (tExpSmooth* const, float val, float factor, tMempool* const); | 168 | void tExpSmooth_initToPool (tExpSmooth* const, float val, float factor, tMempool* const); |
| 88 | void tExpSmooth_free (tExpSmooth* const); | 169 | void tExpSmooth_free (tExpSmooth* const); |
| 89 | 170 | ||
| 90 | float tExpSmooth_tick (tExpSmooth* const); | 171 | float tExpSmooth_tick (tExpSmooth* const); |
| 91 | float tExpSmooth_sample (tExpSmooth* const); | 172 | float tExpSmooth_sample (tExpSmooth* const); |
| 92 | void tExpSmooth_setFactor (tExpSmooth* const, float factor); | 173 | void tExpSmooth_setFactor (tExpSmooth* const, float factor); |
| 93 | void tExpSmooth_setDest (tExpSmooth* const, float dest); | 174 | void tExpSmooth_setDest (tExpSmooth* const, float dest); |
| 94 | void tExpSmooth_setVal (tExpSmooth* const, float val); | 175 | void tExpSmooth_setVal (tExpSmooth* const, float val); |
| 95 | void tExpSmooth_setValAndDest(tExpSmooth* const expsmooth, float val); | 176 | void tExpSmooth_setValAndDest(tExpSmooth* const expsmooth, float val); |
| 96 | 177 | ||
| 97 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 178 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 98 | 179 | ||
| 99 | 180 | ||
| 100 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 181 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 101 | 182 | ||
| 102 | 183 | /*! | |
| 184 | @defgroup tadsr tADSR | ||
| 185 | @ingroup envelopes | ||
| 186 | @brief | ||
| 187 | @{ | ||
| 188 | |||
| 189 | @fn void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release) | ||
| 190 | @brief | ||
| 191 | @param | ||
| 192 | |||
| 193 | @fn void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp) | ||
| 194 | @brief | ||
| 195 | @param | ||
| 196 | |||
| 197 | @fn void tADSR_free (tADSR* const) | ||
| 198 | @brief | ||
| 199 | @param | ||
| 200 | |||
| 201 | @fn float tADSR_tick (tADSR* const) | ||
| 202 | @brief | ||
| 203 | @param | ||
| 204 | |||
| 205 | @fn void tADSR_setAttack (tADSR* const, float attack) | ||
| 206 | @brief | ||
| 207 | @param | ||
| 208 | |||
| 209 | @fn void tADSR_setDecay (tADSR* const, float decay) | ||
| 210 | @brief | ||
| 211 | @param | ||
| 212 | |||
| 213 | @fn void tADSR_setSustain (tADSR* const, float sustain) | ||
| 214 | @brief | ||
| 215 | @param | ||
| 216 | |||
| 217 | @fn void tADSR_setRelease (tADSR* const, float release) | ||
| 218 | @brief | ||
| 219 | @param | ||
| 220 | |||
| 221 | @fn void tADSR_setLeakFactor (tADSR* const, float leakFactor) | ||
| 222 | @brief | ||
| 223 | @param | ||
| 224 | |||
| 225 | @fn void tADSR_on (tADSR* const, float velocity) | ||
| 226 | @brief | ||
| 227 | @param | ||
| 228 | |||
| 229 | @fn void tADSR_off (tADSR* const) | ||
| 230 | @brief | ||
| 231 | @param | ||
| 232 | |||
| 233 | @} */ | ||
| 234 | |||
| 103 | /* ADSR */ | 235 | /* ADSR */ |
| 104 | typedef struct _tADSR | 236 | typedef struct _tADSR |
| 105 | { | 237 | { |
| 106 | tMempool mempool; | 238 | tMempool mempool; |
| 107 | 239 | ||
| 108 | const float *exp_buff; | 240 | const float *exp_buff; |
| 109 | const float *inc_buff; | 241 | const float *inc_buff; |
| 110 | uint32_t buff_size; | 242 | uint32_t buff_size; |
| 111 | 243 | ||
| 112 | float next; | 244 | float next; |
| 113 | 245 | ||
| 114 | float attackInc, decayInc, releaseInc, rampInc; | 246 | float attackInc, decayInc, releaseInc, rampInc; |
| 115 | 247 | ||
| 116 | oBool inAttack, inDecay, inSustain, inRelease, inRamp; | 248 | int inAttack, inDecay, inSustain, inRelease, inRamp; |
| 117 | 249 | ||
| 118 | float sustain, gain, rampPeak, releasePeak; | 250 | float sustain, gain, rampPeak, releasePeak; |
| 119 | 251 | ||
| 120 | float attackPhase, decayPhase, releasePhase, rampPhase; | 252 | float attackPhase, decayPhase, releasePhase, rampPhase; |
| 121 | 253 | ||
| 122 | float leakFactor; | 254 | float leakFactor; |
| 123 | } _tADSR; | 255 | } _tADSR; |
| 124 | |||
| 125 | typedef _tADSR* tADSR; | ||
| 126 | |||
| 127 | void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release); | ||
| 128 | void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp); | ||
| 129 | void tADSR_free (tADSR* const); | ||
| 130 | |||
| 131 | float tADSR_tick (tADSR* const); | ||
| 132 | void tADSR_setAttack (tADSR* const, float attack); | ||
| 133 | void tADSR_setDecay (tADSR* const, float decay); | ||
| 134 | void tADSR_setSustain (tADSR* const, float sustain); | ||
| 135 | void tADSR_setRelease (tADSR* const, float release); | ||
| 136 | void tADSR_setLeakFactor (tADSR* const, float leakFactor); | ||
| 137 | void tADSR_on (tADSR* const, float velocity); | ||
| 138 | void tADSR_off (tADSR* const); | ||
| 139 | |||
| 140 | |||
| 141 | 256 | ||
| 257 | typedef _tADSR* tADSR; | ||
| 258 | |||
| 259 | void tADSR_init (tADSR* const adsrenv, float attack, float decay, float sustain, float release); | ||
| 260 | void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, float sustain, float release, tMempool* const mp); | ||
| 261 | void tADSR_free (tADSR* const); | ||
| 262 | |||
| 263 | float tADSR_tick (tADSR* const); | ||
| 264 | void tADSR_setAttack (tADSR* const, float attack); | ||
| 265 | void tADSR_setDecay (tADSR* const, float decay); | ||
| 266 | void tADSR_setSustain (tADSR* const, float sustain); | ||
| 267 | void tADSR_setRelease (tADSR* const, float release); | ||
| 268 | void tADSR_setLeakFactor (tADSR* const, float leakFactor); | ||
| 269 | void tADSR_on (tADSR* const, float velocity); | ||
| 270 | void tADSR_off (tADSR* const); | ||
| 142 | 271 | ||
| 143 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 272 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 144 | 273 | ||
| 145 | 274 | /*! | |
| 146 | 275 | @defgroup tasdr2 tADSR2 | |
| 147 | /* ADSR2 */ | 276 | @ingroup envelopes |
| 148 | typedef struct _tADSR2 | 277 | @brief |
| 149 | { | 278 | @{ |
| 150 | tMempool mempool; | 279 | |
| 151 | float sampleRateInMs; | 280 | @fn void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release) |
| 152 | float attack; | 281 | @brief |
| 153 | float decay; | 282 | @param |
| 154 | float release; | 283 | |
| 155 | float attackLambda; | 284 | @fn void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const) |
| 156 | float decayLambda; | 285 | @brief |
| 157 | float releaseLambda; | 286 | @param |
| 158 | float sustain; | 287 | |
| 159 | float leakGain; | 288 | @fn void tADSR2_free (tADSR2* const) |
| 160 | float leakFactor; | 289 | @brief |
| 161 | float targetGainSquared; | 290 | @param |
| 162 | float factor; | 291 | |
| 163 | float oneMinusFactor; | 292 | @fn float tADSR2_tick (tADSR2* const) |
| 164 | float gain; | 293 | @brief |
| 165 | uint8_t attacking; | 294 | @param |
| 166 | uint8_t gate; | 295 | |
| 167 | float env; | 296 | @fn void tADSR2_setAttack (tADSR2* const, float attack) |
| 168 | float envTarget; | 297 | @brief |
| 169 | } _tADSR2; | 298 | @param |
| 170 | 299 | ||
| 171 | typedef _tADSR2* tADSR2; | 300 | @fn void tADSR2_setDecay (tADSR2* const, float decay) |
| 172 | 301 | @brief | |
| 173 | void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release); | 302 | @param |
| 174 | void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const); | 303 | |
| 175 | void tADSR2_free (tADSR2* const); | 304 | @fn void tADSR2_setSustain (tADSR2* const, float sustain) |
| 176 | 305 | @brief | |
| 177 | float tADSR2_tick (tADSR2* const); | 306 | @param |
| 178 | void tADSR2_setAttack (tADSR2* const, float attack); | 307 | |
| 179 | void tADSR2_setDecay (tADSR2* const, float decay); | 308 | @fn void tADSR2_setRelease (tADSR2* const, float release) |
| 180 | void tADSR2_setSustain (tADSR2* const, float sustain); | 309 | @brief |
| 181 | void tADSR2_setRelease (tADSR2* const, float release); | 310 | @param |
| 182 | void tADSR2_setLeakFactor (tADSR2* const, float leakFactor); | 311 | |
| 183 | void tADSR2_on (tADSR2* const, float velocity); | 312 | @fn void tADSR2_setLeakFactor (tADSR2* const, float leakFactor) |
| 184 | void tADSR2_off (tADSR2* const); | 313 | @brief |
| 185 | 314 | @param | |
| 186 | 315 | ||
| 187 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 316 | @fn void tADSR2_on (tADSR2* const, float velocity) |
| 188 | 317 | @brief | |
| 189 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 318 | @param |
| 190 | enum envState { | 319 | |
| 191 | env_idle = 0, | 320 | @fn void tADSR2_off (tADSR2* const) |
| 192 | env_attack, | 321 | @brief |
| 193 | env_decay, | 322 | @param |
| 194 | env_sustain, | 323 | |
| 195 | env_release, | 324 | @} */ |
| 196 | env_ramp | 325 | |
| 197 | }; | 326 | typedef struct _tADSR2 |
| 198 | 327 | { | |
| 199 | /* ADSR3 */ | 328 | tMempool mempool; |
| 200 | typedef struct _tADSR3 | 329 | float sampleRateInMs; |
| 201 | { | 330 | float attack; |
| 202 | tMempool mempool; | 331 | float decay; |
| 203 | float sampleRateInMs; | 332 | float release; |
| 204 | int state; | 333 | float attackLambda; |
| 205 | float output; | 334 | float decayLambda; |
| 206 | float attackRate; | 335 | float releaseLambda; |
| 207 | float decayRate; | 336 | float sustain; |
| 208 | float releaseRate; | 337 | float leakGain; |
| 209 | float attackCoef; | 338 | float leakFactor; |
| 210 | float decayCoef; | 339 | float targetGainSquared; |
| 211 | float releaseCoef; | 340 | float factor; |
| 212 | float sustainLevel; | 341 | float oneMinusFactor; |
| 213 | float targetRatioA; | 342 | float gain; |
| 214 | float targetRatioDR; | 343 | uint8_t attacking; |
| 215 | float attackBase; | 344 | uint8_t gate; |
| 216 | float decayBase; | 345 | float env; |
| 217 | float releaseBase; | 346 | float envTarget; |
| 218 | float leakFactor; | 347 | } _tADSR2; |
| 219 | float targetGainSquared; | 348 | |
| 220 | float factor; | 349 | typedef _tADSR2* tADSR2; |
| 221 | float oneMinusFactor; | 350 | |
| 222 | float gain; | 351 | void tADSR2_init (tADSR2* const, float attack, float decay, float sustain, float release); |
| 223 | 352 | void tADSR2_initToPool (tADSR2* const, float attack, float decay, float sustain, float release, tMempool* const); | |
| 224 | } _tADSR3; | 353 | void tADSR2_free (tADSR2* const); |
| 225 | 354 | ||
| 226 | typedef _tADSR3* tADSR3; | 355 | float tADSR2_tick (tADSR2* const); |
| 227 | 356 | void tADSR2_setAttack (tADSR2* const, float attack); | |
| 228 | void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release); | 357 | void tADSR2_setDecay (tADSR2* const, float decay); |
| 229 | void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const); | 358 | void tADSR2_setSustain (tADSR2* const, float sustain); |
| 230 | void tADSR3_free (tADSR3* const); | 359 | void tADSR2_setRelease (tADSR2* const, float release); |
| 231 | 360 | void tADSR2_setLeakFactor (tADSR2* const, float leakFactor); | |
| 232 | float tADSR3_tick (tADSR3* const); | 361 | void tADSR2_on (tADSR2* const, float velocity); |
| 233 | void tADSR3_setAttack (tADSR3* const, float attack); | 362 | void tADSR2_off (tADSR2* const); |
| 234 | void tADSR3_setDecay (tADSR3* const, float decay); | 363 | |
| 235 | void tADSR3_setSustain (tADSR3* const, float sustain); | 364 | |
| 236 | void tADSR3_setRelease (tADSR3* const, float release); | ||
| 237 | void tADSR3_setLeakFactor (tADSR3* const, float leakFactor); | ||
| 238 | void tADSR3_on (tADSR3* const, float velocity); | ||
| 239 | void tADSR3_off (tADSR3* const); | ||
| 240 | |||
| 241 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 365 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 242 | 366 | ||
| 243 | //ADSR4 | 367 | /*! |
| 244 | 368 | @defgroup tadsr3 tADSR3 | |
| 369 | @ingroup envelopes | ||
| 370 | @brief | ||
| 371 | @{ | ||
| 245 | 372 | ||
| 246 | typedef struct _tADSR4 | 373 | @fn void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release) |
| 247 | { | 374 | @brief |
| 248 | tMempool mempool; | 375 | @param |
| 249 | const float *exp_buff; | 376 | |
| 250 | uint32_t buff_size; | 377 | @fn void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const) |
| 251 | uint32_t buff_sizeMinusOne; | 378 | @brief |
| 252 | float bufferSizeDividedBySampleRateInMs; | 379 | @param |
| 253 | float next; | 380 | |
| 254 | 381 | @fn void tADSR3_free (tADSR3* const) | |
| 255 | float attackInc, decayInc, releaseInc, rampInc; | 382 | @brief |
| 256 | 383 | @param | |
| 257 | uint32_t whichStage; | 384 | |
| 258 | 385 | @fn float tADSR3_tick (tADSR3* const) | |
| 259 | float sustain, gain, rampPeak, releasePeak; | 386 | @brief |
| 260 | 387 | @param | |
| 261 | float attackPhase, decayPhase, releasePhase, rampPhase; | 388 | |
| 262 | 389 | @fn void tADSR3_setAttack (tADSR3* const, float attack) | |
| 263 | float leakFactor; | 390 | @brief |
| 264 | } _tADSR4; | 391 | @param |
| 265 | 392 | ||
| 266 | typedef _tADSR4* tADSR4; | 393 | @fn void tADSR3_setDecay (tADSR3* const, float decay) |
| 267 | 394 | @brief | |
| 268 | void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize); | 395 | @param |
| 269 | void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const); | 396 | |
| 270 | void tADSR4_free (tADSR4* const); | 397 | @fn void tADSR3_setSustain (tADSR3* const, float sustain) |
| 271 | 398 | @brief | |
| 272 | float tADSR4_tick (tADSR4* const); | 399 | @param |
| 273 | float tADSR4_tickNoInterp (tADSR4* const adsrenv); | 400 | |
| 274 | void tADSR4_setAttack (tADSR4* const, float attack); | 401 | @fn void tADSR3_setRelease (tADSR3* const, float release) |
| 275 | void tADSR4_setDecay (tADSR4* const, float decay); | 402 | @brief |
| 276 | void tADSR4_setSustain (tADSR4* const, float sustain); | 403 | @param |
| 277 | void tADSR4_setRelease (tADSR4* const, float release); | 404 | |
| 278 | void tADSR4_setLeakFactor (tADSR4* const, float leakFactor); | 405 | @fn void tADSR3_setLeakFactor (tADSR3* const, float leakFactor) |
| 279 | void tADSR4_on (tADSR4* const, float velocity); | 406 | @brief |
| 280 | void tADSR4_off (tADSR4* const); | 407 | @param |
| 281 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 408 | |
| 282 | 409 | @fn void tADSR3_on (tADSR3* const, float velocity) | |
| 283 | /* Ramp */ | 410 | @brief |
| 411 | @param | ||
| 412 | |||
| 413 | @fn void tADSR3_off (tADSR3* const) | ||
| 414 | @brief | ||
| 415 | @param | ||
| 416 | |||
| 417 | @} */ | ||
| 418 | |||
| 419 | enum envState { | ||
| 420 | env_idle = 0, | ||
| 421 | env_attack, | ||
| 422 | env_decay, | ||
| 423 | env_sustain, | ||
| 424 | env_release, | ||
| 425 | env_ramp | ||
| 426 | }; | ||
| 427 | |||
| 428 | typedef struct _tADSR3 | ||
| 429 | { | ||
| 430 | tMempool mempool; | ||
| 431 | float sampleRateInMs; | ||
| 432 | int state; | ||
| 433 | float output; | ||
| 434 | float attackRate; | ||
| 435 | float decayRate; | ||
| 436 | float releaseRate; | ||
| 437 | float attackCoef; | ||
| 438 | float decayCoef; | ||
| 439 | float releaseCoef; | ||
| 440 | float sustainLevel; | ||
| 441 | float targetRatioA; | ||
| 442 | float targetRatioDR; | ||
| 443 | float attackBase; | ||
| 444 | float decayBase; | ||
| 445 | float releaseBase; | ||
| 446 | float leakFactor; | ||
| 447 | float targetGainSquared; | ||
| 448 | float factor; | ||
| 449 | float oneMinusFactor; | ||
| 450 | float gain; | ||
| 451 | |||
| 452 | } _tADSR3; | ||
| 453 | |||
| 454 | typedef _tADSR3* tADSR3; | ||
| 455 | |||
| 456 | void tADSR3_init (tADSR3* const, float attack, float decay, float sustain, float release); | ||
| 457 | void tADSR3_initToPool (tADSR3* const, float attack, float decay, float sustain, float release, tMempool* const); | ||
| 458 | void tADSR3_free (tADSR3* const); | ||
| 459 | |||
| 460 | float tADSR3_tick (tADSR3* const); | ||
| 461 | void tADSR3_setAttack (tADSR3* const, float attack); | ||
| 462 | void tADSR3_setDecay (tADSR3* const, float decay); | ||
| 463 | void tADSR3_setSustain (tADSR3* const, float sustain); | ||
| 464 | void tADSR3_setRelease (tADSR3* const, float release); | ||
| 465 | void tADSR3_setLeakFactor (tADSR3* const, float leakFactor); | ||
| 466 | void tADSR3_on (tADSR3* const, float velocity); | ||
| 467 | void tADSR3_off (tADSR3* const); | ||
| 468 | |||
| 469 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | ||
| 470 | |||
| 471 | /*! | ||
| 472 | @defgroup tadsr4 tADSR4 | ||
| 473 | @ingroup envelopes | ||
| 474 | @brief | ||
| 475 | @{ | ||
| 476 | |||
| 477 | @fn void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize) | ||
| 478 | @brief | ||
| 479 | @param | ||
| 480 | |||
| 481 | @fn void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const) | ||
| 482 | @brief | ||
| 483 | @param | ||
| 484 | |||
| 485 | @fn void tADSR4_free (tADSR4* const) | ||
| 486 | @brief | ||
| 487 | @param | ||
| 488 | |||
| 489 | @fn float tADSR4_tick (tADSR4* const) | ||
| 490 | @brief | ||
| 491 | @param | ||
| 492 | |||
| 493 | @fn float tADSR4_tickNoInterp (tADSR4* const adsrenv) | ||
| 494 | @brief | ||
| 495 | @param | ||
| 496 | |||
| 497 | @fn void tADSR4_setAttack (tADSR4* const, float attack) | ||
| 498 | @brief | ||
| 499 | @param | ||
| 500 | |||
| 501 | @fn void tADSR4_setDecay (tADSR4* const, float decay) | ||
| 502 | @brief | ||
| 503 | @param | ||
| 504 | |||
| 505 | @fn void tADSR4_setSustain (tADSR4* const, float sustain) | ||
| 506 | @brief | ||
| 507 | @param | ||
| 508 | |||
| 509 | @fn void tADSR4_setRelease (tADSR4* const, float release) | ||
| 510 | @brief | ||
| 511 | @param | ||
| 512 | |||
| 513 | @fn void tADSR4_setLeakFactor (tADSR4* const, float leakFactor) | ||
| 514 | @brief | ||
| 515 | @param | ||
| 516 | |||
| 517 | @fn void tADSR4_on (tADSR4* const, float velocity) | ||
| 518 | @brief | ||
| 519 | @param | ||
| 520 | |||
| 521 | @fn void tADSR4_off (tADSR4* const) | ||
| 522 | @brief | ||
| 523 | @param | ||
| 524 | |||
| 525 | @} */ | ||
| 526 | |||
| 527 | typedef struct _tADSR4 | ||
| 528 | { | ||
| 529 | tMempool mempool; | ||
| 530 | const float *exp_buff; | ||
| 531 | uint32_t buff_size; | ||
| 532 | uint32_t buff_sizeMinusOne; | ||
| 533 | float bufferSizeDividedBySampleRateInMs; | ||
| 534 | float next; | ||
| 535 | |||
| 536 | float attackInc, decayInc, releaseInc, rampInc; | ||
| 537 | |||
| 538 | uint32_t whichStage; | ||
| 539 | |||
| 540 | float sustain, gain, rampPeak, releasePeak; | ||
| 541 | |||
| 542 | float attackPhase, decayPhase, releasePhase, rampPhase; | ||
| 543 | |||
| 544 | float leakFactor; | ||
| 545 | } _tADSR4; | ||
| 546 | |||
| 547 | typedef _tADSR4* tADSR4; | ||
| 548 | |||
| 549 | void tADSR4_init (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize); | ||
| 550 | void tADSR4_initToPool (tADSR4* const, float attack, float decay, float sustain, float release, float* expBuffer, int bufferSize, tMempool* const); | ||
| 551 | void tADSR4_free (tADSR4* const); | ||
| 552 | |||
| 553 | float tADSR4_tick (tADSR4* const); | ||
| 554 | float tADSR4_tickNoInterp (tADSR4* const adsrenv); | ||
| 555 | void tADSR4_setAttack (tADSR4* const, float attack); | ||
| 556 | void tADSR4_setDecay (tADSR4* const, float decay); | ||
| 557 | void tADSR4_setSustain (tADSR4* const, float sustain); | ||
| 558 | void tADSR4_setRelease (tADSR4* const, float release); | ||
| 559 | void tADSR4_setLeakFactor (tADSR4* const, float leakFactor); | ||
| 560 | void tADSR4_on (tADSR4* const, float velocity); | ||
| 561 | void tADSR4_off (tADSR4* const); | ||
| 562 | |||
| 563 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | ||
| 564 | |||
| 565 | /*! | ||
| 566 | @defgroup tramp tRamp | ||
| 567 | @ingroup envelopes | ||
| 568 | @brief | ||
| 569 | @{ | ||
| 570 | |||
| 571 | @fn void tRamp_init (tRamp* const, float time, int samplesPerTick) | ||
| 572 | @brief | ||
| 573 | @param | ||
| 574 | |||
| 575 | @fn void tRamp_initToPool (tRamp* const, float time, int samplesPerTick, tMempool* const) | ||
| 576 | @brief | ||
| 577 | @param | ||
| 578 | |||
| 579 | @fn void tRamp_free (tRamp* const) | ||
| 580 | @brief | ||
| 581 | @param | ||
| 582 | |||
| 583 | @fn float tRamp_tick (tRamp* const) | ||
| 584 | @brief | ||
| 585 | @param | ||
| 586 | |||
| 587 | @fn float tRamp_sample (tRamp* const) | ||
| 588 | @brief | ||
| 589 | @param | ||
| 590 | |||
| 591 | @fn void tRamp_setTime (tRamp* const, float time) | ||
| 592 | @brief | ||
| 593 | @param | ||
| 594 | |||
| 595 | @fn void tRamp_setDest (tRamp* const, float dest) | ||
| 596 | @brief | ||
| 597 | @param | ||
| 598 | |||
| 599 | @fn void tRamp_setVal (tRamp* const, float val) | ||
| 600 | @brief | ||
| 601 | @param | ||
| 602 | |||
| 603 | @} */ | ||
| 604 | |||
| 284 | typedef struct _tRamp | 605 | typedef struct _tRamp |
| 285 | { | 606 | { |
| 286 | tMempool mempool; | 607 | tMempool mempool; |
| @@ -304,9 +625,51 @@ extern "C" { · 17 unmodified lines | |||
| 304 | void tRamp_setTime (tRamp* const, float time); | 625 | void tRamp_setTime (tRamp* const, float time); |
| 305 | void tRamp_setDest (tRamp* const, float dest); | 626 | void tRamp_setDest (tRamp* const, float dest); |
| 306 | void tRamp_setVal (tRamp* const, float val); | 627 | void tRamp_setVal (tRamp* const, float val); |
| 307 | 628 | ||
| 308 | ///============= | 629 | /*! |
| 309 | /* Ramp Updown*/ | 630 | @defgroup trampupdown tRampUpDown |
| 631 | @ingroup envelopes | ||
| 632 | @brief | ||
| 633 | @{ | ||
| 634 | |||
| 635 | @fn void tRampUpDown_init (tRampUpDown* const, float upTime, float downTime, int samplesPerTick) | ||
| 636 | @brief | ||
| 637 | @param | ||
| 638 | |||
| 639 | @fn void tRampUpDown_initToPool (tRampUpDown* const, float upTime, float downTime, int samplesPerTick, tMempool* const) | ||
| 640 | @brief | ||
| 641 | @param | ||
| 642 | |||
| 643 | @fn void tRampUpDown_free (tRampUpDown* const) | ||
| 644 | @brief | ||
| 645 | @param | ||
| 646 | |||
| 647 | @fn float tRampUpDown_tick (tRampUpDown* const) | ||
| 648 | @brief | ||
| 649 | @param | ||
| 650 | |||
| 651 | @fn float tRampUpDown_sample (tRampUpDown* const) | ||
| 652 | @brief | ||
| 653 | @param | ||
| 654 | |||
| 655 | @fn void tRampUpDown_setUpTime (tRampUpDown* const, float upTime) | ||
| 656 | @brief | ||
| 657 | @param | ||
| 658 | |||
| 659 | @fn void tRampUpDown_setDownTime (tRampUpDown* const, float downTime) | ||
| 660 | @brief | ||
| 661 | @param | ||
| 662 | |||
| 663 | @fn void tRampUpDown_setDest (tRampUpDown* const, float dest) | ||
| 664 | @brief | ||
| 665 | @param | ||
| 666 | |||
| 667 | @fn void tRampUpDown_setVal (tRampUpDown* const, float val) | ||
| 668 | @brief | ||
| 669 | @param | ||
| 670 | |||
| 671 | @} */ | ||
| 672 | |||
| 310 | typedef struct _tRampUpDown | 673 | typedef struct _tRampUpDown |
| 311 | { | 674 | { |
| 312 | tMempool mempool; | 675 | tMempool mempool; |
| @@ -319,9 +682,9 @@ extern "C" { · 6 unmodified lines | |||
| 319 | float downTime; | 682 | float downTime; |
| 320 | int samples_per_tick; | 683 | int samples_per_tick; |
| 321 | } _tRampUpDown; | 684 | } _tRampUpDown; |
| 322 | 685 | ||
| 323 | typedef _tRampUpDown* tRampUpDown; | 686 | typedef _tRampUpDown* tRampUpDown; |
| 324 | 687 | ||
| 325 | void tRampUpDown_init (tRampUpDown* const, float upTime, float downTime, int samplesPerTick); | 688 | void tRampUpDown_init (tRampUpDown* const, float upTime, float downTime, int samplesPerTick); |
| 326 | void tRampUpDown_initToPool (tRampUpDown* const, float upTime, float downTime, int samplesPerTick, tMempool* const); | 689 | void tRampUpDown_initToPool (tRampUpDown* const, float upTime, float downTime, int samplesPerTick, tMempool* const); |
| 327 | void tRampUpDown_free (tRampUpDown* const); | 690 | void tRampUpDown_free (tRampUpDown* const); |
| @@ -332,39 +695,72 @@ extern "C" { · 4 unmodified lines | |||
| 332 | void tRampUpDown_setDownTime (tRampUpDown* const, float downTime); | 695 | void tRampUpDown_setDownTime (tRampUpDown* const, float downTime); |
| 333 | void tRampUpDown_setDest (tRampUpDown* const, float dest); | 696 | void tRampUpDown_setDest (tRampUpDown* const, float dest); |
| 334 | void tRampUpDown_setVal (tRampUpDown* const, float val); | 697 | void tRampUpDown_setVal (tRampUpDown* const, float val); |
| 335 | 698 | ||
| 336 | 699 | ||
| 337 | ///========================= | 700 | |
| 338 | //Slide (based on Max/MSP's slide~) | 701 | /*! |
| 339 | typedef struct _tSlide | 702 | @defgroup tslide tSlide |
| 703 | @ingroup envelopes | ||
| 704 | @brief based on Max/MSP's slide~ | ||
| 705 | @{ | ||
| 706 | |||
| 707 | @fn void tSlide_init (tSlide* const, float upSlide, float downSlide) | ||
| 708 | @brief | ||
| 709 | @param | ||
| 710 | |||
| 711 | @fn void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const) | ||
| 712 | @brief | ||
| 713 | @param | ||
| 714 | |||
| 715 | @fn void tSlide_free (tSlide* const) | ||
| 716 | @brief | ||
| 717 | @param | ||
| 718 | |||
| 719 | @fn float tSlide_tick (tSlide* const, float in) | ||
| 720 | @brief | ||
| 721 | @param | ||
| 722 | |||
| 723 | @fn float tSlide_tickNoInput (tSlide* const sl) | ||
| 724 | @brief | ||
| 725 | @param | ||
| 726 | |||
| 727 | @fn void tSlide_setUpSlide (tSlide* const sl, float upSlide) | ||
| 728 | @brief | ||
| 729 | @param | ||
| 730 | |||
| 731 | @fn void tSlide_setDownSlide (tSlide* const sl, float downSlide) | ||
| 732 | @brief | ||
| 733 | @param | ||
| 734 | |||
| 735 | @fn void tSlide_setDest (tSlide* const sl, float dest) | ||
| 736 | @brief | ||
| 737 | @param | ||
| 738 | |||
| 739 | @} */ | ||
| 740 | |||
| 741 | typedef struct _tSlide | ||
| 340 | { | 742 | { |
| 341 | tMempool mempool; | 743 | tMempool mempool; |
| 342 | float prevOut; | 744 | float prevOut; |
| 343 | float currentOut; | 745 | float currentOut; |
| 344 | float prevIn; | 746 | float prevIn; |
| 345 | float invUpSlide; | 747 | float invUpSlide; |
| 346 | float invDownSlide; | 748 | float invDownSlide; |
| 347 | float dest; | 749 | float dest; |
| 348 | } _tSlide; | 750 | } _tSlide; |
| 349 | 751 | ||
| 350 | typedef _tSlide* tSlide; | 752 | typedef _tSlide* tSlide; |
| 351 | 753 | ||
| 352 | void tSlide_init (tSlide* const, float upSlide, float downSlide); | 754 | void tSlide_init (tSlide* const, float upSlide, float downSlide); |
| 353 | void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const); | 755 | void tSlide_initToPool (tSlide* const, float upSlide, float downSlide, tMempool* const); |
| 354 | void tSlide_free (tSlide* const); | 756 | void tSlide_free (tSlide* const); |
| 355 | 757 | ||
| 356 | void tSlide_setUpSlide (tSlide* const sl, float upSlide); | 758 | float tSlide_tick (tSlide* const, float in); |
| 357 | 759 | float tSlide_tickNoInput (tSlide* const sl); | |
| 358 | void tSlide_setDownSlide (tSlide* const sl, float downSlide); | 760 | void tSlide_setUpSlide (tSlide* const sl, float upSlide); |
| 359 | 761 | void tSlide_setDownSlide (tSlide* const sl, float downSlide); | |
| 360 | 762 | void tSlide_setDest (tSlide* const sl, float dest); | |
| 361 | void tSlide_setDest (tSlide* const sl, float dest); | 763 | |
| 362 | |||
| 363 | |||
| 364 | float tSlide_tickNoInput (tSlide* const sl); | ||
| 365 | |||
| 366 | float tSlide_tick (tSlide* const, float in); | ||
| 367 | |||
| 368 | #ifdef __cplusplus | 764 | #ifdef __cplusplus |
| 369 | } | 765 | } |
| 370 | #endif | 766 | #endif |
| @@ -373,3 +769,4 @@ extern "C" { · 2 unmodified lines | |||
| 373 | 769 | ||
| 374 | 770 | ||
| 375 | 771 | ||
| 772 | |||
| @@ -35,9 +35,32 @@ extern "C" { · 34 unmodified lines | |||
| 35 | @ingroup filters | 35 | @ingroup filters |
| 36 | @brief Schroeder allpass. Comb-filter with feedforward and feedback. | 36 | @brief Schroeder allpass. Comb-filter with feedforward and feedback. |
| 37 | @{ | 37 | @{ |
| 38 | */ | 38 | |
| 39 | 39 | @fn void tAllpass_init (tAllpass* const, float initDelay, uint32_t maxDelay) | |
| 40 | /*! @} */ | 40 | @brief |
| 41 | @param | ||
| 42 | |||
| 43 | @fn void tAllpass_initToPool (tAllpass* const, float initDelay, uint32_t maxDelay, tMempool* const) | ||
| 44 | @brief | ||
| 45 | @param | ||
| 46 | |||
| 47 | @fn void tAllpass_free (tAllpass* const) | ||
| 48 | @brief | ||
| 49 | @param | ||
| 50 | |||
| 51 | @fn float tAllpass_tick (tAllpass* const, float input) | ||
| 52 | @brief | ||
| 53 | @param | ||
| 54 | |||
| 55 | @fn void tAllpass_setGain (tAllpass* const, float gain) | ||
| 56 | @brief | ||
| 57 | @param | ||
| 58 | |||
| 59 | @fn void tAllpass_setDelay (tAllpass* const, float delay) | ||
| 60 | @brief | ||
| 61 | @param | ||
| 62 |  | ||
| 63 | @} */ | ||
| 41 | 64 | ||
| 42 | typedef struct _tAllpass | 65 | typedef struct _tAllpass |
| 43 | { | 66 | { |
| @@ -68,9 +91,48 @@ extern "C" { · 24 unmodified lines | |||
| 68 | @ingroup filters | 91 | @ingroup filters |
| 69 | @brief OnePole filter, reimplemented from STK (Cook and Scavone). | 92 | @brief OnePole filter, reimplemented from STK (Cook and Scavone). |
| 70 | @{ | 93 | @{ |
| 71 | */ | 94 | |
| 72 | 95 | @fn void tOnePole_init (tOnePole* const, float thePole) | |
| 73 | /*! @} */ | 96 | @brief |
| 97 | @param | ||
| 98 | |||
| 99 | @fn void tOnePole_initToPool (tOnePole* const, float thePole, tMempool* const) | ||
| 100 | @brief | ||
| 101 | @param | ||
| 102 | |||
| 103 | @fn void tOnePole_free (tOnePole* const) | ||
| 104 | @brief | ||
| 105 | @param | ||
| 106 | |||
| 107 | @fn float tOnePole_tick (tOnePole* const, float input) | ||
| 108 | @brief | ||
| 109 | @param | ||
| 110 | |||
| 111 | @fn void tOnePole_setB0 (tOnePole* const, float b0) | ||
| 112 | @brief | ||
| 113 | @param | ||
| 114 | |||
| 115 | @fn void tOnePole_setA1 (tOnePole* const, float a1) | ||
| 116 | @brief | ||
| 117 | @param | ||
| 118 | |||
| 119 | @fn void tOnePole_setPole (tOnePole* const, float thePole) | ||
| 120 | @brief | ||
| 121 | @param | ||
| 122 | |||
| 123 | @fn void tOnePole_setFreq (tOnePole* const, float freq) | ||
| 124 | @brief | ||
| 125 | @param | ||
| 126 | |||
| 127 | @fn void tOnePole_setCoefficients(tOnePole* const, float b0, float a1) | ||
| 128 | @brief | ||
| 129 | @param | ||
| 130 | |||
| 131 | @fn void tOnePole_setGain (tOnePole* const, float gain) | ||
| 132 | @brief | ||
| 133 | @param | ||
| 134 |  | ||
| 135 | @} */ | ||
| 74 | 136 | ||
| 75 | typedef struct _tOnePole | 137 | typedef struct _tOnePole |
| 76 | { | 138 | { |
| @@ -102,9 +164,48 @@ extern "C" { · 25 unmodified lines | |||
| 102 | @ingroup filters | 164 | @ingroup filters |
| 103 | @brief TwoPole filter, reimplemented from STK (Cook and Scavone). | 165 | @brief TwoPole filter, reimplemented from STK (Cook and Scavone). |
| 104 | @{ | 166 | @{ |
| 105 | */ | 167 | |
| 106 | 168 | @fn void tTwoPole_init (tTwoPole* const) | |
| 107 | /*! @} */ | 169 | @brief |
| 170 | @param | ||
| 171 | |||
| 172 | @fn void tTwoPole_initToPool (tTwoPole* const, tMempool* const) | ||
| 173 | @brief | ||
| 174 | @param | ||
| 175 | |||
| 176 | @fn void tTwoPole_free (tTwoPole* const) | ||
| 177 | @brief | ||
| 178 | @param | ||
| 179 | |||
| 180 | @fn float tTwoPole_tick (tTwoPole* const, float input) | ||
| 181 | @brief | ||
| 182 | @param | ||
| 183 | |||
| 184 | @fn void tTwoPole_setB0 (tTwoPole* const, float b0) | ||
| 185 | @brief | ||
| 186 | @param | ||
| 187 | |||
| 188 | @fn void tTwoPole_setA1 (tTwoPole* const, float a1) | ||
| 189 | @brief | ||
| 190 | @param | ||
| 191 | |||
| 192 | @fn void tTwoPole_setA2 (tTwoPole* const, float a2) | ||
| 193 | @brief | ||
| 194 | @param | ||
| 195 | |||
| 196 | @fn void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, int normalize) | ||
| 197 | @brief | ||
| 198 | @param | ||
| 199 | |||
| 200 | @fn void tTwoPole_setCoefficients(tTwoPole* const, float b0, float a1, float a2) | ||
| 201 | @brief | ||
| 202 | @param | ||
| 203 | |||
| 204 | @fn void tTwoPole_setGain (tTwoPole* const, float gain) | ||
| 205 | @brief | ||
| 206 | @param | ||
| 207 |  | ||
| 208 | @} */ | ||
| 108 | 209 | ||
| 109 | typedef struct _tTwoPole | 210 | typedef struct _tTwoPole |
| 110 | { | 211 | { |
| @@ -115,7 +216,7 @@ extern "C" { · 4 unmodified lines | |||
| 115 | float b0; | 216 | float b0; |
| 116 | 217 | ||
| 117 | float radius, frequency; | 218 | float radius, frequency; |
| 118 | oBool normalize; | 219 | int normalize; |
| 119 | 220 | ||
| 120 | float lastOut[2]; | 221 | float lastOut[2]; |
| 121 | } _tTwoPole; | 222 | } _tTwoPole; |
| @@ -130,7 +231,7 @@ extern "C" { · 8 unmodified lines | |||
| 130 | void tTwoPole_setB0 (tTwoPole* const, float b0); | 231 | void tTwoPole_setB0 (tTwoPole* const, float b0); |
| 131 | void tTwoPole_setA1 (tTwoPole* const, float a1); | 232 | void tTwoPole_setA1 (tTwoPole* const, float a1); |
| 132 | void tTwoPole_setA2 (tTwoPole* const, float a2); | 233 | void tTwoPole_setA2 (tTwoPole* const, float a2); |
| 133 | void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, oBool normalize); | 234 | void tTwoPole_setResonance (tTwoPole* const, float freq, float radius, int normalize); |
| 134 | void tTwoPole_setCoefficients(tTwoPole* const, float b0, float a1, float a2); | 235 | void tTwoPole_setCoefficients(tTwoPole* const, float b0, float a1, float a2); |
| 135 | void tTwoPole_setGain (tTwoPole* const, float gain); | 236 | void tTwoPole_setGain (tTwoPole* const, float gain); |
| 136 | 237 | ||
| @@ -141,9 +242,48 @@ extern "C" { · 4 unmodified lines | |||
| 141 | @ingroup filters | 242 | @ingroup filters |
| 142 | @brief OneZero filter, reimplemented from STK (Cook and Scavone). | 243 | @brief OneZero filter, reimplemented from STK (Cook and Scavone). |
| 143 | @{ | 244 | @{ |
| 144 | */ | 245 | |
| 145 | 246 | @fn void tOneZero_init (tOneZero* const, float theZero) | |
| 146 | /*! @} */ | 247 | @brief |
| 248 | @param | ||
| 249 | |||
| 250 | @fn void tOneZero_initToPool (tOneZero* const, float theZero, tMempool* const) | ||
| 251 | @brief | ||
| 252 | @param | ||
| 253 | |||
| 254 | @fn void tOneZero_free (tOneZero* const) | ||
| 255 | @brief | ||
| 256 | @param | ||
| 257 | |||
| 258 | @fn float tOneZero_tick (tOneZero* const, float input) | ||
| 259 | @brief | ||
| 260 | @param | ||
| 261 | |||
| 262 | @fn void tOneZero_setB0 (tOneZero* const, float b0) | ||
| 263 | @brief | ||
| 264 | @param | ||
| 265 | |||
| 266 | @fn void tOneZero_setB1 (tOneZero* const, float b1) | ||
| 267 | @brief | ||
| 268 | @param | ||
| 269 | |||
| 270 | @fn void tOneZero_setZero (tOneZero* const, float theZero) | ||
| 271 | @brief | ||
| 272 | @param | ||
| 273 | |||
| 274 | @fn void tOneZero_setCoefficients(tOneZero* const, float b0, float b1) | ||
| 275 | @brief | ||
| 276 | @param | ||
| 277 | |||
| 278 | @fn void tOneZero_setGain (tOneZero* const, float gain) | ||
| 279 | @brief | ||
| 280 | @param | ||
| 281 | |||
| 282 | @fn float tOneZero_getPhaseDelay (tOneZero *f, float frequency) | ||
| 283 | @brief | ||
| 284 | @param | ||
| 285 |  | ||
| 286 | @} */ | ||
| 147 | 287 | ||
| 148 | typedef struct _tOneZero | 288 | typedef struct _tOneZero |
| 149 | { | 289 | { |
| @@ -165,7 +305,7 @@ extern "C" { · 15 unmodified lines | |||
| 165 | void tOneZero_setZero (tOneZero* const, float theZero); | 305 | void tOneZero_setZero (tOneZero* const, float theZero); |
| 166 | void tOneZero_setCoefficients(tOneZero* const, float b0, float b1); | 306 | void tOneZero_setCoefficients(tOneZero* const, float b0, float b1); |
| 167 | void tOneZero_setGain (tOneZero* const, float gain); | 307 | void tOneZero_setGain (tOneZero* const, float gain); |
| 168 | float tOneZero_getPhaseDelay (tOneZero *f, float frequency ); | 308 | float tOneZero_getPhaseDelay (tOneZero *f, float frequency); |
| 169 | 309 | ||
| 170 | //============================================================================== | 310 | //============================================================================== |
| 171 | 311 | ||
| @@ -174,9 +314,49 @@ extern "C" { · 2 unmodified lines | |||
| 174 | @ingroup filters | 314 | @ingroup filters |
| 175 | @brief TwoZero filter, reimplemented from STK (Cook and Scavone). | 315 | @brief TwoZero filter, reimplemented from STK (Cook and Scavone). |
| 176 | @{ | 316 | @{ |
| 177 | */ | 317 | |
| 178 | 318 | @fn void tTwoZero_init (tTwoZero* const) | |
| 179 | /*! @} */ | 319 | @brief |
| 320 | @param | ||
| 321 | |||
| 322 | @fn void tTwoZero_initToPool (tTwoZero* const, tMempool* const) | ||
| 323 | @brief | ||
| 324 | @param | ||
| 325 | |||
| 326 | @fn void tTwoZero_free (tTwoZero* const) | ||
| 327 | @brief | ||
| 328 | @param | ||
| 329 | |||
| 330 | @fn float tTwoZero_tick (tTwoZero* const, float input) | ||
| 331 | @brief | ||
| 332 | @param | ||
| 333 | |||
| 334 | @fn void tTwoZero_setB0 (tTwoZero* const, float b0) | ||
| 335 | @brief | ||
| 336 | @param | ||
| 337 | |||
| 338 | @fn void tTwoZero_setB1 (tTwoZero* const, float b1) | ||
| 339 | @brief | ||
| 340 | @param | ||
| 341 | |||
| 342 | @fn void tTwoZero_setB2 (tTwoZero* const, float b2) | ||
| 343 | @brief | ||
| 344 | @param | ||
| 345 | |||
| 346 | @fn void tTwoZero_setNotch (tTwoZero* const, float frequency, float radius) | ||
| 347 | @brief | ||
| 348 | @param | ||
| 349 | |||
| 350 | @fn void tTwoZero_setCoefficients(tTwoZero* const, float b0, float b1, float b2) | ||
| 351 | @brief | ||
| 352 | @param | ||
| 353 | |||
| 354 | @fn void tTwoZero_setGain (tTwoZero* const, float gain) | ||
| 355 | @brief | ||
| 356 | @param | ||
| 357 | |||
| 358 |  | ||
| 359 | @} */ | ||
| 180 | 360 | ||
| 181 | typedef struct _tTwoZero | 361 | typedef struct _tTwoZero |
| 182 | { | 362 | { |
| @@ -211,9 +391,54 @@ extern "C" { · 28 unmodified lines | |||
| 211 | @ingroup filters | 391 | @ingroup filters |
| 212 | @brief PoleZero filter, reimplemented from STK (Cook and Scavone). | 392 | @brief PoleZero filter, reimplemented from STK (Cook and Scavone). |
| 213 | @{ | 393 | @{ |
| 214 | */ | 394 | |
| 215 | 395 | @fn void tPoleZero_init (tPoleZero* const) | |
| 216 | /*! @} */ | 396 | @brief |
| 397 | @param | ||
| 398 | |||
| 399 | @fn void tPoleZero_initToPool (tPoleZero* const, tMempool* const) | ||
| 400 | @brief | ||
| 401 | @param | ||
| 402 | |||
| 403 | @fn void tPoleZero_free (tPoleZero* const) | ||
| 404 | @brief | ||
| 405 | @param | ||
| 406 | |||
| 407 | |||
| 408 | @fn float tPoleZero_tick (tPoleZero* const, float input) | ||
| 409 | @brief | ||
| 410 | @param | ||
| 411 | |||
| 412 | @fn void tPoleZero_setB0 (tPoleZero* const, float b0) | ||
| 413 | @brief | ||
| 414 | @param | ||
| 415 | |||
| 416 | @fn void tPoleZero_setB1 (tPoleZero* const, float b1) | ||
| 417 | @brief | ||
| 418 | @param | ||
| 419 | |||
| 420 | @fn void tPoleZero_setA1 (tPoleZero* const, float a1) | ||
| 421 | @brief | ||
| 422 | @param | ||
| 423 | |||
| 424 | @fn void tPoleZero_setCoefficients (tPoleZero* const, float b0, float b1, float a1) | ||
| 425 | @brief | ||
| 426 | @param | ||
| 427 | |||
| 428 | @fn void tPoleZero_setAllpass (tPoleZero* const, float coeff) | ||
| 429 | @brief | ||
| 430 | @param | ||
| 431 | |||
| 432 | @fn void tPoleZero_setBlockZero (tPoleZero* const, float thePole) | ||
| 433 | @brief | ||
| 434 | @param | ||
| 435 | |||
| 436 | @fn void tPoleZero_setGain (tPoleZero* const, float gain) | ||
| 437 | @brief | ||
| 438 | @param | ||
| 439 | |||
| 440 |  | ||
| 441 | @} */ | ||
| 217 | 442 | ||
| 218 | typedef struct _tPoleZero | 443 | typedef struct _tPoleZero |
| 219 | { | 444 | { |
| @@ -248,9 +473,62 @@ extern "C" { · 28 unmodified lines | |||
| 248 | @ingroup filters | 473 | @ingroup filters |
| 249 | @brief BiQuad filter, reimplemented from STK (Cook and Scavone). | 474 | @brief BiQuad filter, reimplemented from STK (Cook and Scavone). |
| 250 | @{ | 475 | @{ |
| 251 | */ | 476 | |
| 252 | 477 | @fn void tBiQuad_init (tBiQuad* const) | |
| 253 | /*! @} */ | 478 | @brief |
| 479 | @param | ||
| 480 | |||
| 481 | @fn void tBiQuad_initToPool (tBiQuad* const, tMempool* const) | ||
| 482 | @brief | ||
| 483 | @param | ||
| 484 | |||
| 485 | @fn void tBiQuad_free (tBiQuad* const) | ||
| 486 | @brief | ||
| 487 | @param | ||
| 488 | |||
| 489 | |||
| 490 | @fn float tBiQuad_tick (tBiQuad* const, float input) | ||
| 491 | @brief | ||
| 492 | @param | ||
| 493 | |||
| 494 | @fn void tBiQuad_setB0 (tBiQuad* const, float b0) | ||
| 495 | @brief | ||
| 496 | @param | ||
| 497 | |||
| 498 | @fn void tBiQuad_setB1 (tBiQuad* const, float b1) | ||
| 499 | @brief | ||
| 500 | @param | ||
| 501 | |||
| 502 | @fn void tBiQuad_setB2 (tBiQuad* const, float b2) | ||
| 503 | @brief | ||
| 504 | @param | ||
| 505 | |||
| 506 | @fn void tBiQuad_setA1 (tBiQuad* const, float a1) | ||
| 507 | @brief | ||
| 508 | @param | ||
| 509 | |||
| 510 | @fn void tBiQuad_setA2 (tBiQuad* const, float a2) | ||
| 511 | @brief | ||
| 512 | @param | ||
| 513 | |||
| 514 | @fn void tBiQuad_setNotch (tBiQuad* const, float freq, float radius) | ||
| 515 | @brief | ||
| 516 | @param | ||
| 517 | |||
| 518 | @fn void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, int normalize) | ||
| 519 | @brief | ||
| 520 | @param | ||
| 521 | |||
| 522 | @fn void tBiQuad_setCoefficients(tBiQuad* const, float b0, float b1, float b2, float a1, float a2) | ||
| 523 | @brief | ||
| 524 | @param | ||
| 525 | |||
| 526 | @fn void tBiQuad_setGain (tBiQuad* const, float gain) | ||
| 527 | @brief | ||
| 528 | @param | ||
| 529 | |||
| 530 |  | ||
| 531 | @} */ | ||
| 254 | 532 | ||
| 255 | typedef struct _tBiQuad | 533 | typedef struct _tBiQuad |
| 256 | { | 534 | { |
| @@ -264,7 +542,7 @@ extern "C" { · 7 unmodified lines | |||
| 264 | float lastOut[2]; | 542 | float lastOut[2]; |
| 265 | 543 | ||
| 266 | float frequency, radius; | 544 | float frequency, radius; |
| 267 | oBool normalize; | 545 | int normalize; |
| 268 | } _tBiQuad; | 546 | } _tBiQuad; |
| 269 | 547 | ||
| 270 | typedef _tBiQuad* tBiQuad; | 548 | typedef _tBiQuad* tBiQuad; |
| @@ -280,7 +558,7 @@ extern "C" { · 9 unmodified lines | |||
| 280 | void tBiQuad_setA1 (tBiQuad* const, float a1); | 558 | void tBiQuad_setA1 (tBiQuad* const, float a1); |
| 281 | void tBiQuad_setA2 (tBiQuad* const, float a2); | 559 | void tBiQuad_setA2 (tBiQuad* const, float a2); |
| 282 | void tBiQuad_setNotch (tBiQuad* const, float freq, float radius); | 560 | void tBiQuad_setNotch (tBiQuad* const, float freq, float radius); |
| 283 | void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, oBool normalize); | 561 | void tBiQuad_setResonance (tBiQuad* const, float freq, float radius, int normalize); |
| 284 | void tBiQuad_setCoefficients(tBiQuad* const, float b0, float b1, float b2, float a1, float a2); | 562 | void tBiQuad_setCoefficients(tBiQuad* const, float b0, float b1, float b2, float a1, float a2); |
| 285 | void tBiQuad_setGain (tBiQuad* const, float gain); | 563 | void tBiQuad_setGain (tBiQuad* const, float gain); |
| 286 | 564 | ||
| @@ -291,9 +569,36 @@ extern "C" { · 4 unmodified lines | |||
| 291 | @ingroup filters | 569 | @ingroup filters |
| 292 | @brief State Variable Filter, algorithm from Andy Simper. | 570 | @brief State Variable Filter, algorithm from Andy Simper. |
| 293 | @{ | 571 | @{ |
| 294 | */ | 572 | |
| 295 | 573 | @fn void tSVF_init (tSVF* const, SVFType type, float freq, float Q) | |
| 296 | /*! @} */ | 574 | @brief |
| 575 | @param | ||
| 576 | |||
| 577 | @fn void tSVF_initToPool (tSVF* const, SVFType type, float freq, float Q, tMempool* const) | ||
| 578 | @brief | ||
| 579 | @param | ||
| 580 | |||
| 581 | @fn void tSVF_free (tSVF* const) | ||
| 582 | @brief | ||
| 583 | @param | ||
| 584 | |||
| 585 | @fn float tSVF_tick (tSVF* const, float v0) | ||
| 586 | |||
| 587 | @brief | ||
| 588 | @param | ||
| 589 | @fn void tSVF_setFreq (tSVF* const, float freq) | ||
| 590 | @brief | ||
| 591 | @param | ||
| 592 | |||
| 593 | @fn void tSVF_setQ (tSVF* const, float Q) | ||
| 594 | @brief | ||
| 595 | @param | ||
| 596 | |||
| 597 | @fn void tSVF_setFreqAndQ (tSVF* const svff, float freq, float Q) | ||
| 598 | @brief | ||
| 599 | @param | ||
| 600 |  | ||
| 601 | @} */ | ||
| 297 | 602 | ||
| 298 | typedef enum SVFType | 603 | typedef enum SVFType |
| 299 | { | 604 | { |
| @@ -325,6 +630,7 @@ extern "C" { · 25 unmodified lines | |||
| 325 | void tSVF_setFreq (tSVF* const, float freq); | 630 | void tSVF_setFreq (tSVF* const, float freq); |
| 326 | void tSVF_setQ (tSVF* const, float Q); | 631 | void tSVF_setQ (tSVF* const, float Q); |
| 327 | void tSVF_setFreqAndQ (tSVF* const svff, float freq, float Q); | 632 | void tSVF_setFreqAndQ (tSVF* const svff, float freq, float Q); |
| 633 | |||
| 328 | //============================================================================== | 634 | //============================================================================== |
| 329 | 635 | ||
| 330 | /*! | 636 | /*! |
| @@ -332,9 +638,32 @@ extern "C" { · 1 unmodified line | |||
| 332 | @ingroup filters | 638 | @ingroup filters |
| 333 | @brief Efficient State Variable Filter for 14-bit control input, [0, 4096). | 639 | @brief Efficient State Variable Filter for 14-bit control input, [0, 4096). |
| 334 | @{ | 640 | @{ |
| 335 | */ | 641 | |
| 336 | 642 | @fn void tEfficientSVF_init (tEfficientSVF* const, SVFType type, uint16_t input, float Q) | |
| 337 | /*! @} */ | 643 | @brief |
| 644 | @param | ||
| 645 | |||
| 646 | @fn void tEfficientSVF_initToPool (tEfficientSVF* const, SVFType type, uint16_t input, float Q, tMempool* const) | ||
| 647 | @brief | ||
| 648 | @param | ||
| 649 | |||
| 650 | @fn void tEfficientSVF_free (tEfficientSVF* const) | ||
| 651 | @brief | ||
| 652 | @param | ||
| 653 | |||
| 654 | @fn float tEfficientSVF_tick (tEfficientSVF* const, float v0) | ||
| 655 | @brief | ||
| 656 | @param | ||
| 657 | |||
| 658 | @fn void tEfficientSVF_setFreq (tEfficientSVF* const, uint16_t controlFreq) | ||
| 659 | @brief | ||
| 660 | @param | ||
| 661 | |||
| 662 | @fn void tEfficientSVF_setQ (tEfficientSVF* const, float Q) | ||
| 663 | @brief | ||
| 664 | @param | ||
| 665 |  | ||
| 666 | @} */ | ||
| 338 | 667 | ||
| 339 | typedef struct _tEfficientSVF | 668 | typedef struct _tEfficientSVF |
| 340 | { | 669 | { |
| @@ -362,9 +691,32 @@ extern "C" { · 21 unmodified lines | |||
| 362 | @ingroup filters | 691 | @ingroup filters |
| 363 | @brief Simple Highpass filter. | 692 | @brief Simple Highpass filter. |
| 364 | @{ | 693 | @{ |
| 365 | */ | 694 | |
| 366 | 695 | @fn void tHighpass_init (tHighpass* const, float freq) | |
| 367 | /*! @} */ | 696 | @brief |
| 697 | @param | ||
| 698 | |||
| 699 | @fn void tHighpass_initToPool (tHighpass* const, float freq, tMempool* const) | ||
| 700 | @brief | ||
| 701 | @param | ||
| 702 | |||
| 703 | @fn void tHighpass_free (tHighpass* const) | ||
| 704 | @brief | ||
| 705 | @param | ||
| 706 | |||
| 707 | @fn float tHighpass_tick (tHighpass* const, float x) | ||
| 708 | @brief | ||
| 709 | @param | ||
| 710 | |||
| 711 | @fn void tHighpass_setFreq (tHighpass* const, float freq) | ||
| 712 | @brief | ||
| 713 | @param | ||
| 714 | |||
| 715 | @fn float tHighpass_getFreq (tHighpass* const) | ||
| 716 | @brief | ||
| 717 | @param | ||
| 718 |  | ||
| 719 | @} */ | ||
| 368 | 720 | ||
| 369 | typedef struct _tHighpass | 721 | typedef struct _tHighpass |
| 370 | { | 722 | { |
| @@ -390,9 +742,36 @@ extern "C" { · 19 unmodified lines | |||
| 390 | @ingroup filters | 742 | @ingroup filters |
| 391 | @brief | 743 | @brief |
| 392 | @{ | 744 | @{ |
| 393 | */ | 745 | |
| 394 | 746 | @fn void tButterworth_init (tButterworth* const, int N, float f1, float f2) | |
| 395 | /*! @} */ | 747 | @brief |
| 748 | @param | ||
| 749 | |||
| 750 | @fn void tButterworth_initToPool (tButterworth* const, int N, float f1, float f2, tMempool* const) | ||
| 751 | @brief | ||
| 752 | @param | ||
| 753 | |||
| 754 | @fn void tButterworth_free (tButterworth* const) | ||
| 755 | @brief | ||
| 756 | @param | ||
| 757 | |||
| 758 | @fn float tButterworth_tick (tButterworth* const, float input) | ||
| 759 | @brief | ||
| 760 | @param | ||
| 761 | |||
| 762 | @fn void tButterworth_setF1 (tButterworth* const, float in) | ||
| 763 | @brief | ||
| 764 | @param | ||
| 765 | |||
| 766 | @fn void tButterworth_setF2 (tButterworth* const, float in) | ||
| 767 | @brief | ||
| 768 | @param | ||
| 769 | |||
| 770 | @fn void tButterworth_setFreqs (tButterworth* const, float f1, float f2) | ||
| 771 | @brief | ||
| 772 | @param | ||
| 773 |  | ||
| 774 | @} */ | ||
| 396 | 775 | ||
| 397 | #define NUM_SVF_BW 16 | 776 | #define NUM_SVF_BW 16 |
| 398 | typedef struct _tButterworth | 777 | typedef struct _tButterworth |
| @@ -427,9 +806,24 @@ extern "C" { · 28 unmodified lines | |||
| 427 | @ingroup filters | 806 | @ingroup filters |
| 428 | @brief | 807 | @brief |
| 429 | @{ | 808 | @{ |
| 430 | */ | 809 | |
| 431 | 810 | @fn void tFIR_init (tFIR* const, float* coeffs, int numTaps) | |
| 432 | /*! @} */ | 811 | @brief |
| 812 | @param | ||
| 813 | |||
| 814 | @fn void tFIR_initToPool (tFIR* const, float* coeffs, int numTaps, tMempool* const) | ||
| 815 | @brief | ||
| 816 | @param | ||
| 817 | |||
| 818 | @fn void tFIR_free (tFIR* const) | ||
| 819 | @brief | ||
| 820 | @param | ||
| 821 | |||
| 822 | @fn float tFIR_tick (tFIR* const, float input) | ||
| 823 | @brief | ||
| 824 | @param | ||
| 825 |  | ||
| 826 | @} */ | ||
| 433 | 827 | ||
| 434 | typedef struct _tFIR | 828 | typedef struct _tFIR |
| 435 | { | 829 | { |
| @@ -455,9 +849,24 @@ extern "C" { · 19 unmodified lines | |||
| 455 | @ingroup filters | 849 | @ingroup filters |
| 456 | @brief | 850 | @brief |
| 457 | @{ | 851 | @{ |
| 458 | */ | 852 | |
| 459 | 853 | @fn void tMedianFilter_init (tMedianFilter* const, int size) | |
| 460 | /*! @} */ | 854 | @brief |
| 855 | @param | ||
| 856 | |||
| 857 | @fn void tMedianFilter_initToPool (tMedianFilter* const, int size, tMempool* const) | ||
| 858 | @brief | ||
| 859 | @param | ||
| 860 | |||
| 861 | @fn void tMedianFilter_free (tMedianFilter* const) | ||
| 862 | @brief | ||
| 863 | @param | ||
| 864 | |||
| 865 | @fn float tMedianFilter_tick (tMedianFilter* const, float input) | ||
| 866 | @brief | ||
| 867 | @param | ||
| 868 |  | ||
| 869 | @} */ | ||
| 461 | 870 | ||
| 462 | typedef struct _tMedianFilter | 871 | typedef struct _tMedianFilter |
| 463 | { | 872 | { |
| @@ -483,13 +892,60 @@ extern "C" { · 19 unmodified lines | |||
| 483 | /*! | 892 | /*! |
| 484 | @defgroup tvzfilter tVZFilter | 893 | @defgroup tvzfilter tVZFilter |
| 485 | @ingroup filters | 894 | @ingroup filters |
| 486 | @brief | 895 | @brief Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum) |
| 487 | @{ | 896 | @{ |
| 488 | */ | 897 | |
| 489 | 898 | @fn void tVZFilter_init (tVZFilter* const, VZFilterType type, float freq, float Q) | |
| 490 | /*! @} */ | 899 | @brief |
| 491 | 900 | @param | |
| 492 | //Vadim Zavalishin style from VA book (from implementation in RSlib posted to kvr forum) | 901 | |
| 902 | @fn void tVZFilter_initToPool (tVZFilter* const, VZFilterType type, float freq, float Q, tMempool* const) | ||
| 903 | @brief | ||
| 904 | @param | ||
| 905 | |||
| 906 | @fn void tVZFilter_free (tVZFilter* const) | ||
| 907 | @brief | ||
| 908 | @param | ||
| 909 | |||
| 910 | @fn void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate) | ||
| 911 | @brief | ||
| 912 | @param | ||
| 913 | |||
| 914 | @fn float tVZFilter_tick (tVZFilter* const, float input) | ||
| 915 | @brief | ||
| 916 | @param | ||
| 917 | |||
| 918 | @fn float tVZFilter_tickEfficient (tVZFilter* const vf, float in) | ||
| 919 | @brief | ||
| 920 | @param | ||
| 921 | |||
| 922 | @fn void tVZFilter_calcCoeffs (tVZFilter* const) | ||
| 923 | @brief | ||
| 924 | @param | ||
| 925 | |||
| 926 | @fn void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth) | ||
| 927 | @brief | ||
| 928 | @param | ||
| 929 | |||
| 930 | @fn void tVZFilter_setFreq (tVZFilter* const, float freq) | ||
| 931 | @brief | ||
| 932 | @param | ||
| 933 | |||
| 934 | @fn void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw) | ||
| 935 | @brief | ||
| 936 | @param | ||
| 937 | @fn void tVZFilter_setGain (tVZFilter* const, float gain) | ||
| 938 | @brief | ||
| 939 | @param | ||
| 940 | @fn void tVZFilter_setType (tVZFilter* const, VZFilterType type) | ||
| 941 | @brief | ||
| 942 | @param | ||
| 943 | |||
| 944 | @fn float tVZFilter_BandwidthToR (tVZFilter* const vf, float B) | ||
| 945 | @brief | ||
| 946 | @param | ||
| 947 |  | ||
| 948 | @} */ | ||
| 493 | 949 | ||
| 494 | typedef enum VZFilterType | 950 | typedef enum VZFilterType |
| 495 | { | 951 | { |
| @@ -538,16 +994,16 @@ extern "C" { · 42 unmodified lines | |||
| 538 | void tVZFilter_initToPool (tVZFilter* const, VZFilterType type, float freq, float Q, tMempool* const); | 994 | void tVZFilter_initToPool (tVZFilter* const, VZFilterType type, float freq, float Q, tMempool* const); |
| 539 | void tVZFilter_free (tVZFilter* const); | 995 | void tVZFilter_free (tVZFilter* const); |
| 540 | 996 | ||
| 541 | void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate); | 997 | void tVZFilter_setSampleRate (tVZFilter* const, float sampleRate); |
| 542 | float tVZFilter_tick (tVZFilter* const, float input); | 998 | float tVZFilter_tick (tVZFilter* const, float input); |
| 543 | float tVZFilter_tickEfficient (tVZFilter* const vf, float in); | 999 | float tVZFilter_tickEfficient (tVZFilter* const vf, float in); |
| 544 | void tVZFilter_calcCoeffs (tVZFilter* const); | 1000 | void tVZFilter_calcCoeffs (tVZFilter* const); |
| 545 | void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth); | 1001 | void tVZFilter_setBandwidth (tVZFilter* const, float bandWidth); |
| 546 | void tVZFilter_setFreq (tVZFilter* const, float freq); | 1002 | void tVZFilter_setFreq (tVZFilter* const, float freq); |
| 547 | void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw); | 1003 | void tVZFilter_setFreqAndBandwidth (tVZFilter* const vf, float freq, float bw); |
| 548 | void tVZFilter_setGain (tVZFilter* const, float gain); | 1004 | void tVZFilter_setGain (tVZFilter* const, float gain); |
| 549 | void tVZFilter_setType (tVZFilter* const, VZFilterType type); | 1005 | void tVZFilter_setType (tVZFilter* const, VZFilterType type); |
| 550 | float tVZFilter_BandwidthToR (tVZFilter* const vf, float B); | 1006 | float tVZFilter_BandwidthToR (tVZFilter* const vf, float B); |
| 551 | 1007 | ||
| 552 | 1008 | ||
| 553 | /*! | 1009 | /*! |
| @@ -555,9 +1011,32 @@ extern "C" { · 1 unmodified line | |||
| 555 | @ingroup filters | 1011 | @ingroup filters |
| 556 | @brief | 1012 | @brief |
| 557 | @{ | 1013 | @{ |
| 558 | */ | 1014 | |
| 559 | 1015 | @fn void tDiodeFilter_init (tDiodeFilter* const, float freq, float Q) | |
| 560 | /*! @} */ | 1016 | @brief |
| 1017 | @param | ||
| 1018 | |||
| 1019 | @fn void tDiodeFilter_initToPool (tDiodeFilter* const, float freq, float Q, tMempool* const) | ||
| 1020 | @brief | ||
| 1021 | @param | ||
| 1022 | |||
| 1023 | @fn void tDiodeFilter_free (tDiodeFilter* const) | ||
| 1024 | @brief | ||
| 1025 | @param | ||
| 1026 | |||
| 1027 | @fn float tDiodeFilter_tick (tDiodeFilter* const, float input) | ||
| 1028 | @brief | ||
| 1029 | @param | ||
| 1030 | |||
| 1031 | @fn void tDiodeFilter_setFreq (tDiodeFilter* const vf, float cutoff) | ||
| 1032 | @brief | ||
| 1033 | @param | ||
| 1034 | |||
| 1035 | @fn void tDiodeFilter_setQ (tDiodeFilter* const vf, float resonance) | ||
| 1036 | @brief | ||
| 1037 | @param | ||
| 1038 |  | ||
| 1039 | @} */ | ||
| 561 | 1040 | ||
| 562 | //diode ladder filter | 1041 | //diode ladder filter |
| 563 | typedef struct _tDiodeFilter | 1042 | typedef struct _tDiodeFilter |
| @@ -31,7 +31,58 @@ extern "C" { · 30 unmodified lines | |||
| 31 | 31 | ||
| 32 | //============================================================================== | 32 | //============================================================================== |
| 33 | 33 | ||
| 34 | // 808 Cowbell | 34 | /*! |
| 35 | @defgroup t808cowbell t808Cowbell | ||
| 36 | @ingroup instruments | ||
| 37 | @brief | ||
| 38 | @{ | ||
| 39 | |||
| 40 | @fn void t808Cowbell_init (t808Cowbell* const, int useStick) | ||
| 41 | @brief | ||
| 42 | @param | ||
| 43 | |||
| 44 | @fn void t808Cowbell_initToPool (t808Cowbell* const, int useStick, tMempool* const) | ||
| 45 | @brief | ||
| 46 | @param | ||
| 47 | |||
| 48 | @fn void t808Cowbell_free (t808Cowbell* const) | ||
| 49 | @brief | ||
| 50 | @param | ||
| 51 | |||
| 52 | @fn float t808Cowbell_tick (t808Cowbell* const) | ||
| 53 | @brief | ||
| 54 | @param | ||
| 55 | |||
| 56 | @fn void t808Cowbell_on (t808Cowbell* const, float vel) | ||
| 57 | @brief | ||
| 58 | @param | ||
| 59 | |||
| 60 | @fn void t808Cowbell_setDecay (t808Cowbell* const, float decay) | ||
| 61 | @brief | ||
| 62 | @param | ||
| 63 | |||
| 64 | @fn void t808Cowbell_setHighpassFreq (t808Cowbell* const, float freq) | ||
| 65 | @brief | ||
| 66 | @param | ||
| 67 | |||
| 68 | @fn void t808Cowbell_setBandpassFreq (t808Cowbell* const, float freq) | ||
| 69 | @brief | ||
| 70 | @param | ||
| 71 | |||
| 72 | @fn void t808Cowbell_setFreq (t808Cowbell* const, float freq) | ||
| 73 | @brief | ||
| 74 | @param | ||
| 75 | |||
| 76 | @fn void t808Cowbell_setOscMix (t808Cowbell* const, float oscMix) | ||
| 77 | @brief | ||
| 78 | @param | ||
| 79 | |||
| 80 | @fn void t808Cowbell_setStick (t808Cowbell* const, int useStick) | ||
| 81 | @brief | ||
| 82 | @param | ||
| 83 | |||
| 84 | @} */ | ||
| 85 | |||
| 35 | typedef struct _t808Cowbell | 86 | typedef struct _t808Cowbell |
| 36 | { | 87 | { |
| 37 | tMempool mempool; | 88 | tMempool mempool; |
| @@ -65,7 +116,74 @@ extern "C" { · 27 unmodified lines | |||
| 65 | 116 | ||
| 66 | //============================================================================== | 117 | //============================================================================== |
| 67 | 118 | ||
| 68 | // 808 Hihat | 119 | /*! |
| 120 | @defgroup t808hihat t808Hihat | ||
| 121 | @ingroup instruments | ||
| 122 | @brief | ||
| 123 | @{ | ||
| 124 | |||
| 125 | @fn void t808Hihat_init (t808Hihat* const) | ||
| 126 | @brief | ||
| 127 | @param | ||
| 128 | |||
| 129 | @fn void t808Hihat_initToPool (t808Hihat* const, tMempool* const) | ||
| 130 | @brief | ||
| 131 | @param | ||
| 132 | |||
| 133 | @fn void t808Hihat_free (t808Hihat* const) | ||
| 134 | @brief | ||
| 135 | @param | ||
| 136 | |||
| 137 | @fn float t808Hihat_tick (t808Hihat* const) | ||
| 138 | @brief | ||
| 139 | @param | ||
| 140 | |||
| 141 | @fn void t808Hihat_on (t808Hihat* const, float vel) | ||
| 142 | @brief | ||
| 143 | @param | ||
| 144 | |||
| 145 | @fn void t808Hihat_setOscNoiseMix (t808Hihat* const, float oscNoiseMix) | ||
| 146 | @brief | ||
| 147 | @param | ||
| 148 | |||
| 149 | @fn void t808Hihat_setDecay (t808Hihat* const, float decay) | ||
| 150 | @brief | ||
| 151 | @param | ||
| 152 | |||
| 153 | @fn void t808Hihat_setHighpassFreq (t808Hihat* const, float freq) | ||
| 154 | @brief | ||
| 155 | @param | ||
| 156 | |||
| 157 | @fn void t808Hihat_setOscBandpassFreq (t808Hihat* const, float freq) | ||
| 158 | @brief | ||
| 159 | @param | ||
| 160 | |||
| 161 | @fn void t808Hihat_setOscBandpassQ (t808Hihat* const hihat, float Q) | ||
| 162 | @brief | ||
| 163 | @param | ||
| 164 | |||
| 165 | @fn void t808Hihat_setStickBandPassFreq (t808Hihat* const, float freq) | ||
| 166 | @brief | ||
| 167 | @param | ||
| 168 | |||
| 169 | @fn void t808Hihat_setStickBandPassQ (t808Hihat* const hihat, float Q) | ||
| 170 | @brief | ||
| 171 | @param | ||
| 172 | |||
| 173 | @fn void t808Hihat_setOscFreq (t808Hihat* const, float freq) | ||
| 174 | @brief | ||
| 175 | @param | ||
| 176 | |||
| 177 | @fn void t808Hihat_setStretch (t808Hihat* const hihat, float stretch) | ||
| 178 | @brief | ||
| 179 | @param | ||
| 180 | |||
| 181 | @fn void t808Hihat_setFM (t808Hihat* const hihat, float FM_amount) | ||
| 182 | @brief | ||
| 183 | @param | ||
| 184 | |||
| 185 | @} */ | ||
| 186 | |||
| 69 | typedef struct _t808Hihat | 187 | typedef struct _t808Hihat |
| 70 | { | 188 | { |
| 71 | tMempool mempool; | 189 | tMempool mempool; |
| @@ -107,7 +225,66 @@ extern "C" { · 35 unmodified lines | |||
| 107 | 225 | ||
| 108 | //============================================================================== | 226 | //============================================================================== |
| 109 | 227 | ||
| 110 | // 808 Snare | 228 | /*! |
| 229 | @defgroup t808snare t808Snare | ||
| 230 | @ingroup instruments | ||
| 231 | @brief | ||
| 232 | @{ | ||
| 233 | |||
| 234 | @fn void t808Snare_init (t808Snare* const) | ||
| 235 | @brief | ||
| 236 | @param | ||
| 237 | |||
| 238 | @fn void t808Snare_initToPool (t808Snare* const, tMempool* const) | ||
| 239 | @brief | ||
| 240 | @param | ||
| 241 | |||
| 242 | @fn void t808Snare_free (t808Snare* const) | ||
| 243 | @brief | ||
| 244 | @param | ||
| 245 | |||
| 246 | @fn float t808Snare_tick (t808Snare* const) | ||
| 247 | @brief | ||
| 248 | @param | ||
| 249 | |||
| 250 | @fn void t808Snare_on (t808Snare* const, float vel) | ||
| 251 | @brief | ||
| 252 | @param | ||
| 253 | |||
| 254 | @fn void t808Snare_setTone1Freq (t808Snare* const, float freq) | ||
| 255 | @brief | ||
| 256 | @param | ||
| 257 | |||
| 258 | @fn void t808Snare_setTone2Freq (t808Snare* const, float freq) | ||
| 259 | @brief | ||
| 260 | @param | ||
| 261 | |||
| 262 | @fn void t808Snare_setTone1Decay (t808Snare* const, float decay) | ||
| 263 | @brief | ||
| 264 | @param | ||
| 265 | |||
| 266 | @fn void t808Snare_setTone2Decay (t808Snare* const, float decay) | ||
| 267 | @brief | ||
| 268 | @param | ||
| 269 | |||
| 270 | @fn void t808Snare_setNoiseDecay (t808Snare* const, float decay) | ||
| 271 | @brief | ||
| 272 | @param | ||
| 273 | |||
| 274 | @fn void t808Snare_setToneNoiseMix (t808Snare* const, float toneNoiseMix) | ||
| 275 | @brief | ||
| 276 | @param | ||
| 277 | |||
| 278 | @fn void t808Snare_setNoiseFilterFreq (t808Snare* const, float noiseFilterFreq) | ||
| 279 | @brief | ||
| 280 | @param | ||
| 281 | |||
| 282 | @fn void t808Snare_setNoiseFilterQ (t808Snare* const, float noiseFilterQ) | ||
| 283 | @brief | ||
| 284 | @param | ||
| 285 | |||
| 286 | @} */ | ||
| 287 | |||
| 111 | typedef struct _t808Snare | 288 | typedef struct _t808Snare |
| 112 | { | 289 | { |
| 113 | tMempool mempool; | 290 | tMempool mempool; |
| @@ -151,7 +328,66 @@ extern "C" { · 37 unmodified lines | |||
| 151 | 328 | ||
| 152 | //============================================================================== | 329 | //============================================================================== |
| 153 | 330 | ||
| 154 | // 808 Kick | 331 | /*! |
| 332 | @defgroup t808kick t808Kick | ||
| 333 | @ingroup instruments | ||
| 334 | @brief | ||
| 335 | @{ | ||
| 336 | |||
| 337 | @fn void t808Kick_init (t808Kick* const) | ||
| 338 | @brief | ||
| 339 | @param | ||
| 340 | |||
| 341 | @fn void t808Kick_initToPool (t808Kick* const, tMempool* const) | ||
| 342 | @brief | ||
| 343 | @param | ||
| 344 | |||
| 345 | @fn void t808Kick_free (t808Kick* const) | ||
| 346 | @brief | ||
| 347 | @param | ||
| 348 | |||
| 349 | @fn float t808Kick_tick (t808Kick* const) | ||
| 350 | @brief | ||
| 351 | @param | ||
| 352 | |||
| 353 | @fn void t808Kick_on (t808Kick* const, float vel) | ||
| 354 | @brief | ||
| 355 | @param | ||
| 356 | |||
| 357 | @fn void t808Kick_setToneFreq (t808Kick* const, float freq) | ||
| 358 | @brief | ||
| 359 | @param | ||
| 360 | |||
| 361 | @fn void t808Kick_setToneDecay (t808Kick* const, float decay) | ||
| 362 | @brief | ||
| 363 | @param | ||
| 364 | |||
| 365 | @fn void t808Kick_setNoiseDecay (t808Kick* const, float decay) | ||
| 366 | @brief | ||
| 367 | @param | ||
| 368 | |||
| 369 | @fn void t808Kick_setSighAmount (t808Kick* const, float sigh) | ||
| 370 | @brief | ||
| 371 | @param | ||
| 372 | |||
| 373 | @fn void t808Kick_setChirpAmount (t808Kick* const, float chirp) | ||
| 374 | @brief | ||
| 375 | @param | ||
| 376 | |||
| 377 | @fn void t808Kick_setToneNoiseMix (t808Kick* const, float toneNoiseMix) | ||
| 378 | @brief | ||
| 379 | @param | ||
| 380 | |||
| 381 | @fn void t808Kick_setNoiseFilterFreq (t808Kick* const, float noiseFilterFreq) | ||
| 382 | @brief | ||
| 383 | @param | ||
| 384 | |||
| 385 | @fn void t808Kick_setNoiseFilterQ (t808Kick* const, float noiseFilterQ) | ||
| 386 | @brief | ||
| 387 | @param | ||
| 388 | |||
| 389 | @} */ | ||
| 390 | |||
| 155 | typedef struct _t808Kick | 391 | typedef struct _t808Kick |
| 156 | { | 392 | { |
| 157 | tMempool mempool; | 393 | tMempool mempool; |
| @@ -23,11 +23,10 @@ extern "C" { · 22 unmodified lines | |||
| 23 | 23 | ||
| 24 | //============================================================================== | 24 | //============================================================================== |
| 25 | 25 | ||
| 26 | typedef enum oBool | 26 | /*! |
| 27 | { | 27 | @ingroup math |
| 28 | OTRUE = 1, | 28 | @{ |
| 29 | OFALSE = 0 | 29 | */ |
| 30 | }oBool; | ||
| 31 | 30 | ||
| 32 | // Allows for bitwise operations on floats | 31 | // Allows for bitwise operations on floats |
| 33 | union unholy_t { /* a union between a float and an integer */ | 32 | union unholy_t { /* a union between a float and an integer */ |
| @@ -110,8 +109,8 @@ extern "C" { · 76 unmodified lines | |||
| 110 | 109 | ||
| 111 | float LEAF_clip (float min, float val, float max); | 110 | float LEAF_clip (float min, float val, float max); |
| 112 | int LEAF_clipInt (int min, int val, int max); | 111 | int LEAF_clipInt (int min, int val, int max); |
| 113 | float LEAF_softClip (float val, float thresh); | 112 | float LEAF_softClip (float val, float thresh); |
| 114 | oBool LEAF_isPrime (uint64_t number ); | 113 | int LEAF_isPrime (uint64_t number ); |
| 115 | 114 | ||
| 116 | float LEAF_midiToFrequency (float f); | 115 | float LEAF_midiToFrequency (float f); |
| 117 | float LEAF_frequencyToMidi(float f); | 116 | float LEAF_frequencyToMidi(float f); |
| @@ -219,6 +218,7 @@ extern "C" { · 101 unmodified lines | |||
| 219 | 218 | ||
| 220 | float median3f(float a, float b, float c); | 219 | float median3f(float a, float b, float c); |
| 221 | 220 | ||
| 221 | /*! @} */ | ||
| 222 | 222 | ||
| 223 | //============================================================================== | 223 | //============================================================================== |
| 224 | 224 | ||
| @@ -112,7 +112,8 @@ extern "C" { · 111 unmodified lines | |||
| 112 | */ | 112 | */ |
| 113 | void tMempool_freeFromPool (tMempool* const pool, tMempool* const poolFrom); | 113 | void tMempool_freeFromPool (tMempool* const pool, tMempool* const poolFrom); |
| 114 | 114 | ||
| 115 | /*! @} */ | 115 | /*! |
| 116 | @} */ | ||
| 116 | 117 | ||
| 117 | //============================================================================== | 118 | //============================================================================== |
| 118 | 119 | ||
| @@ -31,15 +31,79 @@ extern "C" { · 30 unmodified lines | |||
| 31 | //============================================================================== | 31 | //============================================================================== |
| 32 | 32 | ||
| 33 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 33 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 34 | 34 | ||
| 35 | /*! | 35 | /*! |
| 36 | * @defgroup tstack tStack | 36 | @defgroup tstack tStack |
| 37 | * @ingroup midi | 37 | @ingroup midi |
| 38 | * @brief A basic stack of integers with a fixed max size of 128, used by tPoly to keep track of MIDI notes. | 38 | @brief A basic stack of integers with a fixed capacity of 128, used by tPoly to keep track of MIDI notes. |
| 39 | * @{ | 39 | @{ |
| 40 | */ | 40 | |
| 41 | @fn void tStack_init (tStack* const stack) | ||
| 42 | @brief Initialize a tStack to the default LEAF mempool. | ||
| 43 | @param stack A pointer to the tStack to be initialized. | ||
| 44 | |||
| 45 | @fn void tStack_initToPool (tStack* const stack, tMempool* const mempool) | ||
| 46 | @brief Initialize a tStack to a specified mempool. | ||
| 47 | @param stack A pointer to the tStack to be initialized. | ||
| 48 | @param mempool A pointer to the tMempool to which the tStack should be initialized. | ||
| 49 | |||
| 50 | @fn void tStack_free (tStack* const stack) | ||
| 51 | @brief Free a tStack from the default LEAF mempool. | ||
| 52 | @param stack A pointer to the tStack to be freed. | ||
| 53 | |||
| 54 | @fn void tStack_setCapacity (tStack* const stack, uint16_t cap) | ||
| 55 | @brief Set the capacity of the stack. | ||
| 56 | @param stack A pointer to the relevant tStack. | ||
| 57 | @param cap The new capacity. | ||
| 58 | |||
| 59 | @fn int tStack_addIfNotAlreadyThere (tStack* const stack, uint16_t item) | ||
| 60 | @brief Add a value to the stack only if that value is not already in the stack. | ||
| 61 | @param stack A pointer to the relevant tStack. | ||
| 62 | @param item The value to be added. | ||
| 63 | |||
| 64 | @fn void tStack_add (tStack* const stack, uint16_t item) | ||
| 65 | @brief Add a value to the stack. | ||
| 66 | @param stack A pointer to the relevant tStack. | ||
| 67 | @param item The value to be added. | ||
| 68 | |||
| 69 | @fn int tStack_remove (tStack* const stack, uint16_t item) | ||
| 70 | @brief Remove a single instance of a value from the stack. | ||
| 71 | @param stack A pointer to the relevant tStack. | ||
| 72 | @param item The value to be removed. | ||
| 73 | |||
| 74 | @fn void tStack_clear (tStack* const stack) | ||
| 75 | @brief Clear the stack. | ||
| 76 | @param stack A pointer to the relevant tStack. | ||
| 77 | |||
| 78 | @fn int tStack_first (tStack* const stack) | ||
| 79 | @brief Get the first value in the stack. | ||
| 80 | @param stack A pointer to the relevant tStack. | ||
| 81 | @return The first value in the stack. | ||
| 82 | |||
| 83 | @fn int tStack_getSize (tStack* const stack) | ||
| 84 | @brief Get the current size of the stack. | ||
| 85 | @param stack A pointer to the relevant tStack. | ||
| 86 | @return The current size of the stack. | ||
| 87 | |||
| 88 | @fn int tStack_contains (tStack* const stack, uint16_t item) | ||
| 89 | @brief Check if the stack contains a value, and if it does, get the index of that value. | ||
| 90 | @param stack A pointer to the relevant tStack. | ||
| 91 | @param item The value to check against the stack. | ||
| 92 | @return The index of the value or -1 if the stack does not contain the value. | ||
| 93 | |||
| 94 | @fn int tStack_next (tStack* const stack) | ||
| 95 | @brief Get the next value in the stack, starting from the earliest added values. | ||
| 96 | @param stack A pointer to the relevant tStack. | ||
| 97 | @return The next value in the stack or -1 if there are no values in the stack. | ||
| 98 | |||
| 99 | @fn int tStack_get (tStack* const stack, int index) | ||
| 100 | @brief Get the value at a given index of the stack. | ||
| 101 | @param stack A pointer to the relevant tStack. | ||
| 102 | @param index The index of the stack from which to get a value. | ||
| 103 | @return The value at the given index. | ||
| 104 | |||
| 105 | @} */ | ||
| 41 | 106 | ||
| 42 | // STACK implementation (fixed size) | ||
| 43 | #define STACK_SIZE 128 | 107 | #define STACK_SIZE 128 |
| 44 | typedef struct _tStack | 108 | typedef struct _tStack |
| 45 | { | 109 | { |
| @@ -48,120 +112,139 @@ extern "C" { · 2 unmodified lines | |||
| 48 | uint16_t pos; | 112 | uint16_t pos; |
| 49 | uint16_t size; | 113 | uint16_t size; |
| 50 | uint16_t capacity; | 114 | uint16_t capacity; |
| 51 | oBool ordered; | 115 | int ordered; |
| 52 | } _tStack; | 116 | } _tStack; |
| 53 | 117 | ||
| 54 | typedef _tStack* tStack; | 118 | typedef _tStack* tStack; |
| 55 | 119 | ||
| 56 | //! Initialize a tStack to the default LEAF mempool. | ||
| 57 | /*! | ||
| 58 | @param stack A pointer to the tStack to be initialized. | ||
| 59 | */ | ||
| 60 | void tStack_init (tStack* const stack); | 120 | void tStack_init (tStack* const stack); |
| 61 | |||
| 62 | |||
| 63 | //! Initialize a tStack to a specified mempool. | ||
| 64 | /*! | ||
| 65 | @param stack A pointer to the tStack to be initialized. | ||
| 66 | @param pool A pointer to the tMempool to which the tStack should be initialized. | ||
| 67 | */ | ||
| 68 | void tStack_initToPool (tStack* const stack, tMempool* const pool); | 121 | void tStack_initToPool (tStack* const stack, tMempool* const pool); |
| 69 | |||
| 70 | |||
| 71 | //! Free a tStack from the default LEAF mempool. | ||
| 72 | /*! | ||
| 73 | @param stack A pointer to the tStack to be freed. | ||
| 74 | */ | ||
| 75 | void tStack_free (tStack* const stack); | 122 | void tStack_free (tStack* const stack); |
| 76 | 123 | ||
| 77 | |||
| 78 | //! Set the capacity of the stack. | ||
| 79 | /*! | ||
| 80 | @param stack A pointer to the relevant tStack. | ||
| 81 | @param cap The new capacity. | ||
| 82 | */ | ||
| 83 | void tStack_setCapacity (tStack* const stack, uint16_t cap); | 124 | void tStack_setCapacity (tStack* const stack, uint16_t cap); |
| 84 | |||
| 85 | |||
| 86 | //! Add a value to the stack only if that value is not already in the stack. | ||
| 87 | /*! | ||
| 88 | @param stack A pointer to the relevant tStack. | ||
| 89 | @param item The value to be added. | ||
| 90 | */ | ||
| 91 | int tStack_addIfNotAlreadyThere (tStack* const stack, uint16_t item); | 125 | int tStack_addIfNotAlreadyThere (tStack* const stack, uint16_t item); |
| 92 | |||
| 93 | |||
| 94 | //! Add a value to the stack. | ||
| 95 | /*! | ||
| 96 | @param stack A pointer to the relevant tStack. | ||
| 97 | @param item The value to be added. | ||
| 98 | */ | ||
| 99 | void tStack_add (tStack* const stack, uint16_t item); | 126 | void tStack_add (tStack* const stack, uint16_t item); |
| 100 | |||
| 101 | |||
| 102 | //! Remove a single instance of a value from the stack. | ||
| 103 | /*! | ||
| 104 | @param stack A pointer to the relevant tStack. | ||
| 105 | @param item The value to be removed. | ||
| 106 | */ | ||
| 107 | int tStack_remove (tStack* const stack, uint16_t item); | 127 | int tStack_remove (tStack* const stack, uint16_t item); |
| 108 | |||
| 109 | |||
| 110 | //! Clear the stack. | ||
| 111 | /*! | ||
| 112 | @param stack A pointer to the relevant tStack. | ||
| 113 | */ | ||
| 114 | void tStack_clear (tStack* const stack); | 128 | void tStack_clear (tStack* const stack); |
| 115 | |||
| 116 | |||
| 117 | //! Get the first value in the stack. | ||
| 118 | /*! | ||
| 119 | @param stack A pointer to the relevant tStack. | ||
| 120 | @return The first value in the stack. | ||
| 121 | */ | ||
| 122 | int tStack_first (tStack* const stack); | 129 | int tStack_first (tStack* const stack); |
| 123 | |||
| 124 | |||
| 125 | //! Get the current size of the stack. | ||
| 126 | /*! | ||
| 127 | @param stack A pointer to the relevant tStack. | ||
| 128 | @return The current size of the stack. | ||
| 129 | */ | ||
| 130 | int tStack_getSize (tStack* const stack); | 130 | int tStack_getSize (tStack* const stack); |
| 131 | |||
| 132 | //! Check if the stack contains a value, and if it does, get the index of that value. | ||
| 133 | /*! | ||
| 134 | @param stack A pointer to the relevant tStack. | ||
| 135 | @param item The value to check against the stack. | ||
| 136 | @return The index of the value or -1 if the stack does not contain the value. | ||
| 137 | */ | ||
| 138 | int tStack_contains (tStack* const stack, uint16_t item); | 131 | int tStack_contains (tStack* const stack, uint16_t item); |
| 139 | |||
| 140 | //! Get the next value in the stack, starting from the earliest added values. | ||
| 141 | /*! | ||
| 142 | @param stack A pointer to the relevant tStack. | ||
| 143 | @return The next value in the stack or -1 if there are no values in the stack. | ||
| 144 | */ | ||
| 145 | int tStack_next (tStack* const stack); | 132 | int tStack_next (tStack* const stack); |
| 146 | |||
| 147 | //! Get the value at a given index of the stack. | ||
| 148 | /*! | ||
| 149 | @param stack A pointer to the relevant tStack. | ||
| 150 | @param index The index of the stack from which to get a value. | ||
| 151 | @return The value at the given index. | ||
| 152 | */ | ||
| 153 | int tStack_get (tStack* const stack, int index); | 133 | int tStack_get (tStack* const stack, int index); |
| 154 | 134 | ||
| 155 | /*! @} */ | 135 | /*! @} |
| 156 | 136 | @defgroup tpoly tPoly | |
| 157 | /*! | 137 | @ingroup midi |
| 158 | * @defgroup tpoly tPoly | 138 | @brief An object for polyphonic handling. |
| 159 | * @ingroup midi | 139 | @{ |
| 160 | * @brief An object for polyphonic handling. | 140 | |
| 161 | * @{ | 141 | @fn void tPoly_init (tPoly* const poly, int maxNumVoices) |
| 162 | */ | 142 | @brief Initialize a tPoly to the default LEAF mempool. |
| 163 | 143 | @param poly A pointer to the tPoly to be initialized. | |
| 164 | /* tPoly */ | 144 | @param maxNumVoices The maximum number of voices this tPoly can handle at once. |
| 145 | |||
| 146 | @fn void tPoly_initToPool (tPoly* const poly, int maxNumVoices, tMempool* const pool) | ||
| 147 | @brief Initialize a tPoly to a specified mempool. | ||
| 148 | @param poly A pointer to the tPoly to be initialized. | ||
| 149 | @param pool A pointer to the tMempool to which the tPoly should be initialized. | ||
| 150 | |||
| 151 | @fn void tPoly_free (tPoly* const poly) | ||
| 152 | @brief Free a tPoly from the default LEAF mempool. | ||
| 153 | @param poly A pointer to the tPoly to be freed. | ||
| 154 | |||
| 155 | @fn int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel) | ||
| 156 | @brief Add a note with a given velocity to the poly handler. | ||
| 157 | @param poly A pointer to the relevant tPoly. | ||
| 158 | @param note The MIDI note number to add. | ||
| 159 | @param vel The MIDI velocity of the note to add. | ||
| 160 | @return The voice that will play the note. | ||
| 161 | |||
| 162 | @fn int tPoly_noteOff (tPoly* const poly, uint8_t note) | ||
| 163 | @brief Remove a note from the poly handler. | ||
| 164 | @param poly A pointer to the relevant tPoly. | ||
| 165 | @param note The MIDI note number to remove. | ||
| 166 | @return The voice that was playing the removed note. | ||
| 167 | |||
| 168 | @fn void tPoly_orderedAddToStack (tPoly* const poly, uint8_t note) | ||
| 169 | @brief | ||
| 170 | @param | ||
| 171 | |||
| 172 | @fn void tPoly_setNumVoices (tPoly* const poly, uint8_t numVoices) | ||
| 173 | @brief Set the number of voices available to play notes. | ||
| 174 | @param poly A pointer to the relevant tPoly. | ||
| 175 | @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init(). | ||
| 176 | |||
| 177 | @fn void tPoly_setPitchGlideActive (tPoly* const poly, int isActive) | ||
| 178 | @brief Set whether pitch glide over note changes in voices is active. | ||
| 179 | @param poly A pointer to the relevant tPoly. | ||
| 180 | @param isActive Whether pitch glide should be active or not. | ||
| 181 | |||
| 182 | @fn void tPoly_setPitchGlideTime (tPoly* const poly, float t) | ||
| 183 | @brief Set how long pitch glide over note changes in voices takes. | ||
| 184 | @param poly A pointer to the relevant tPoly. | ||
| 185 | @param t The time to glide in milliseconds. | ||
| 186 | |||
| 187 | @fn void tPoly_setPitchBend (tPoly* const poly, float pitchBend) | ||
| 188 | @brief Set the amount of pitch bend | ||
| 189 | @param poly A pointer to the relevant tPoly. | ||
| 190 | @param pitchBend The new amount of pitch bend. | ||
| 191 | |||
| 192 | @fn void tPoly_setBendGlideTime (tPoly* const poly, float t) | ||
| 193 | @brief | ||
| 194 | @param | ||
| 195 | |||
| 196 | @fn void tPoly_setBendSamplesPerTick (tPoly* const poly, float t) | ||
| 197 | @brief | ||
| 198 | @param | ||
| 199 | |||
| 200 | @fn void tPoly_tickPitch (tPoly* const poly) | ||
| 201 | @brief Execute all tick-rate changes in the poly handler's pitch, including glide and bend. | ||
| 202 | @param poly A pointer to the relevant tPoly. | ||
| 203 | |||
| 204 | @fn void tPoly_tickPitchGlide (tPoly* const poly) | ||
| 205 | @brief Execute the tick-rate change of the poly handler's pitch glide. | ||
| 206 | @param poly A pointer to the relevant tPoly. | ||
| 207 | |||
| 208 | @fn void tPoly_tickPitchBend (tPoly* const poly) | ||
| 209 | @brief Execute the tick-rate change of the poly handler's pitch bend. | ||
| 210 | @param poly A pointer to the relevant tPoly. | ||
| 211 | |||
| 212 | @fn int tPoly_getNumVoices (tPoly* const poly) | ||
| 213 | @brief Get the current number of voices available to play notes. | ||
| 214 | @param poly A pointer to the relevant tPoly. | ||
| 215 | @return The current number of voices available to play notes. | ||
| 216 | |||
| 217 | @fn int tPoly_getNumActiveVoices (tPoly* const poly) | ||
| 218 | @brief Get the number of voices currently playing notes. | ||
| 219 | @param poly A pointer to the relevant tPoly. | ||
| 220 | @return The number of voices currently playing notes. | ||
| 221 | |||
| 222 | @fn float tPoly_getPitch (tPoly* const poly, uint8_t voice) | ||
| 223 | @brief Get the current pitch of a given voice. | ||
| 224 | @param poly A pointer to the relevant tPoly. | ||
| 225 | @param voice The voice to get the pitch of. | ||
| 226 | @return The current pitch of the given voice as a fractional MIDI note number. | ||
| 227 | |||
| 228 | @fn int tPoly_getKey (tPoly* const poly, uint8_t voice) | ||
| 229 | @brief Get the current MIDI note number of a given voice. | ||
| 230 | @param poly A pointer to the relevant tPoly. | ||
| 231 | @param voice The voice to get the MIDI note number of. | ||
| 232 | @return The MIDI note number of the given voice. | ||
| 233 | |||
| 234 | @fn int tPoly_getVelocity (tPoly* const poly, uint8_t voice) | ||
| 235 | @brief Get the current MIDI velocity of a given voice. | ||
| 236 | @param poly A pointer to the relevant tPoly. | ||
| 237 | @param voice The voice to get the MIDI velocity of. | ||
| 238 | @return The current MIDI velocity of the given voice. | ||
| 239 | |||
| 240 | @fn int tPoly_isOn (tPoly* const poly, uint8_t voice) | ||
| 241 | @brief Get the current play state of a given voice. | ||
| 242 | @param poly A pointer to the relevant tPoly. | ||
| 243 | @param voice The voice to get the state of. | ||
| 244 | @return The current play state of the given voice. | ||
| 245 | |||
| 246 | @} */ | ||
| 247 | |||
| 165 | typedef struct _tPoly | 248 | typedef struct _tPoly |
| 166 | { | 249 | { |
| 167 | tMempool mempool; | 250 | tMempool mempool; |
| @@ -171,9 +254,9 @@ extern "C" { · 3 unmodified lines | |||
| 171 | 254 | ||
| 172 | tRamp* ramps; | 255 | tRamp* ramps; |
| 173 | float* rampVals; | 256 | float* rampVals; |
| 174 | oBool* firstReceived; | 257 | int* firstReceived; |
| 175 | float glideTime; | 258 | float glideTime; |
| 176 | oBool pitchGlideIsActive; | 259 | int pitchGlideIsActive; |
| 177 | 260 | ||
| 178 | int numVoices; | 261 | int numVoices; |
| 179 | int maxNumVoices; | 262 | int maxNumVoices; |
| @@ -200,158 +283,113 @@ extern "C" { · 20 unmodified lines | |||
| 200 | 283 | ||
| 201 | typedef _tPoly* tPoly; | 284 | typedef _tPoly* tPoly; |
| 202 | 285 | ||
| 203 | /* MPoly*/ | ||
| 204 | //! Initialize a tPoly to the default LEAF mempool. | ||
| 205 | /*! | ||
| 206 | @param poly A pointer to the tPoly to be initialized. | ||
| 207 | @param maxNumVoices The maximum number of voices this tPoly can handle at once. | ||
| 208 | */ | ||
| 209 | void tPoly_init (tPoly* const poly, int maxNumVoices); | 286 | void tPoly_init (tPoly* const poly, int maxNumVoices); |
| 210 | |||
| 211 | |||
| 212 | //! Initialize a tPoly to a specified mempool. | ||
| 213 | /*! | ||
| 214 | @param poly A pointer to the tPoly to be initialized. | ||
| 215 | @param pool A pointer to the tMempool to which the tPoly should be initialized. | ||
| 216 | */ | ||
| 217 | void tPoly_initToPool (tPoly* const poly, int maxNumVoices, tMempool* const pool); | 287 | void tPoly_initToPool (tPoly* const poly, int maxNumVoices, tMempool* const pool); |
| 218 | |||
| 219 | |||
| 220 | //! Free a tPoly from the default LEAF mempool. | ||
| 221 | /*! | ||
| 222 | @param poly A pointer to the tPoly to be freed. | ||
| 223 | */ | ||
| 224 | void tPoly_free (tPoly* const poly); | 288 | void tPoly_free (tPoly* const poly); |
| 225 | 289 | ||
| 226 | |||
| 227 | //! Add a note with a given velocity to the poly handler. | ||
| 228 | /*! | ||
| 229 | @param poly A pointer to the relevant tPoly. | ||
| 230 | @param note The MIDI note number to add. | ||
| 231 | @param vel The MIDI velocity of the note to add. | ||
| 232 | @return The voice that will play the note. | ||
| 233 | */ | ||
| 234 | int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel); | 290 | int tPoly_noteOn (tPoly* const poly, int note, uint8_t vel); |
| 235 | |||
| 236 | |||
| 237 | //! Remove a note from the poly handler. | ||
| 238 | /*! | ||
| 239 | @param poly A pointer to the relevant tPoly. | ||
| 240 | @param note The MIDI note number to remove. | ||
| 241 | @return The voice that was playing the removed note. | ||
| 242 | */ | ||
| 243 | int tPoly_noteOff (tPoly* const poly, uint8_t note); | 291 | int tPoly_noteOff (tPoly* const poly, uint8_t note); |
| 244 | |||
| 245 | void tPoly_orderedAddToStack (tPoly* const poly, uint8_t note); | 292 | void tPoly_orderedAddToStack (tPoly* const poly, uint8_t note); |
| 246 | |||
| 247 | |||
| 248 | //! Set the number of voices available to play notes. | ||
| 249 | /*! | ||
| 250 | @param poly A pointer to the relevant tPoly. | ||
| 251 | @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init(). | ||
| 252 | */ | ||
| 253 | void tPoly_setNumVoices (tPoly* const poly, uint8_t numVoices); | 293 | void tPoly_setNumVoices (tPoly* const poly, uint8_t numVoices); |
| 254 | 294 | void tPoly_setPitchGlideActive (tPoly* const poly, int isActive); | |
| 255 | //! Set whether pitch glide over note changes in voices is active. | ||
| 256 | /*! | ||
| 257 | @param poly A pointer to the relevant tPoly. | ||
| 258 | @param isActive Whether pitch glide should be active or not. | ||
| 259 | */ | ||
| 260 | void tPoly_setPitchGlideActive (tPoly* const poly, oBool isActive); | ||
| 261 | |||
| 262 | //! Set how long pitch glide over note changes in voices takes. | ||
| 263 | /*! | ||
| 264 | @param poly A pointer to the relevant tPoly. | ||
| 265 | @param t The time to glide in milliseconds. | ||
| 266 | */ | ||
| 267 | void tPoly_setPitchGlideTime (tPoly* const poly, float t); | 295 | void tPoly_setPitchGlideTime (tPoly* const poly, float t); |
| 268 | |||
| 269 | //! Set the amount of pitch bend | ||
| 270 | /*! | ||
| 271 | @param poly A pointer to the relevant tPoly. | ||
| 272 | @param pitchBend The new amount of pitch bend. | ||
| 273 | */ | ||
| 274 | void tPoly_setPitchBend (tPoly* const poly, float pitchBend); | 296 | void tPoly_setPitchBend (tPoly* const poly, float pitchBend); |
| 275 | void tPoly_setBendGlideTime (tPoly* const poly, float t); | 297 | void tPoly_setBendGlideTime (tPoly* const poly, float t); |
| 276 | void tPoly_setBendSamplesPerTick (tPoly* const poly, float t); | 298 | void tPoly_setBendSamplesPerTick (tPoly* const poly, float t); |
| 299 | void tPoly_tickPitch (tPoly* const poly); | ||
| 300 | void tPoly_tickPitchGlide (tPoly* const poly); | ||
| 301 | void tPoly_tickPitchBend (tPoly* const poly); | ||
| 302 | int tPoly_getNumVoices (tPoly* const poly); | ||
| 303 | int tPoly_getNumActiveVoices (tPoly* const poly); | ||
| 304 | float tPoly_getPitch (tPoly* const poly, uint8_t voice); | ||
| 305 | int tPoly_getKey (tPoly* const poly, uint8_t voice); | ||
| 306 | int tPoly_getVelocity (tPoly* const poly, uint8_t voice); | ||
| 307 | int tPoly_isOn (tPoly* const poly, uint8_t voice); | ||
| 277 | 308 | ||
| 278 | 309 | //============================================================================== | |
| 279 | //! Execute all tick-rate changes in the poly handler's pitch, including glide and bend. | 310 | |
| 280 | /*! | 311 | /*! @} |
| 312 | @defgroup tsimplepoly tSimplePoly | ||
| 313 | @ingroup midi | ||
| 314 | @brief An object for polyphonic handling. | ||
| 315 | @{ | ||
| 316 | |||
| 317 | @fn void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices) | ||
| 318 | @brief Initialize a tPoly to the default LEAF mempool. | ||
| 319 | @param poly A pointer to the tPoly to be initialized. | ||
| 320 | @param maxNumVoices The maximum number of voices this tPoly can handle at once. | ||
| 321 | |||
| 322 | @fn void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool) | ||
| 323 | @brief Initialize a tPoly to a specified mempool. | ||
| 324 | @param poly A pointer to the tPoly to be initialized. | ||
| 325 | @param pool A pointer to the tMempool to which the tPoly should be initialized. | ||
| 326 | |||
| 327 | @fn void tSimplePoly_free (tSimplePoly* const poly) | ||
| 328 | @brief Free a tPoly from the default LEAF mempool. | ||
| 329 | @param poly A pointer to the tPoly to be freed. | ||
| 330 | |||
| 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. | ||
| 281 | @param poly A pointer to the relevant tPoly. | 333 | @param poly A pointer to the relevant tPoly. |
| 282 | */ | 334 | @param note The MIDI note number to add. |
| 283 | void tPoly_tickPitch (tPoly* const poly); | 335 | @param vel The MIDI velocity of the note to add. |
| 284 | 336 | @return The voice that will play the note. | |
| 285 | 337 | ||
| 286 | //! Execute the tick-rate change of the poly handler's pitch glide. | 338 | @fn int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note) |
| 287 | /*! | 339 | @brief Remove a note from the poly handler. |
| 288 | @param poly A pointer to the relevant tPoly. | 340 | @param poly A pointer to the relevant tPoly. |
| 289 | */ | 341 | @param note The MIDI note number to remove. |
| 290 | void tPoly_tickPitchGlide (tPoly* const poly); | 342 | @return The voice that was playing the removed note. |
| 291 | 343 | ||
| 292 | 344 | @fn void tSimplePoly_deactivateVoice(tSimplePoly* const polyh, uint8_t voice) | |
| 293 | //! Execute the tick-rate change of the poly handler's pitch bend. | 345 | @brief |
| 294 | /*! | 346 | @param |
| 347 | |||
| 348 | @fn int tSimplePoly_markPendingNoteOff(tSimplePoly* const polyh, uint8_t note) | ||
| 349 | @brief | ||
| 350 | @param | ||
| 351 | |||
| 352 | @fn int tSimplePoly_findVoiceAssignedToNote(tSimplePoly* const polyh, uint8_t note) | ||
| 353 | @brief Find if there is a voice with that note -- useful for note offs where you want to wait to remove it from the poly until the release phase of the envelope is finished | ||
| 354 | @param | ||
| 355 | |||
| 356 | @fn void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices) | ||
| 357 | @brief Set the number of voices available to play notes. | ||
| 295 | @param poly A pointer to the relevant tPoly. | 358 | @param poly A pointer to the relevant tPoly. |
| 296 | */ | 359 | @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init(). |
| 297 | void tPoly_tickPitchBend (tPoly* const poly); | 360 | |
| 298 | 361 | @fn int tSimplePoly_getNumVoices (tSimplePoly* const poly) | |
| 299 | 362 | @brief Get the current number of voices available to play notes. | |
| 300 | //! Get the current number of voices available to play notes. | ||
| 301 | /*! | ||
| 302 | @param poly A pointer to the relevant tPoly. | 363 | @param poly A pointer to the relevant tPoly. |
| 303 | @return The current number of voices available to play notes. | 364 | @return The current number of voices available to play notes. |
| 304 | */ | 365 | |
| 305 | int tPoly_getNumVoices (tPoly* const poly); | 366 | @fn int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly) |
| 306 | 367 | @brief Get the number of voices currently playing notes. | |
| 307 | //! Get the number of voices currently playing notes. | ||
| 308 | /*! | ||
| 309 | @param poly A pointer to the relevant tPoly. | 368 | @param poly A pointer to the relevant tPoly. |
| 310 | @return The number of voices currently playing notes. | 369 | @return The number of voices currently playing notes. |
| 311 | */ | 370 | |
| 312 | int tPoly_getNumActiveVoices (tPoly* const poly); | 371 | @fn int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice) |
| 313 | 372 | @brief Get the current MIDI note number of a given voice. | |
| 314 | //! Get the current pitch of a given voice. | ||
| 315 | /*! | ||
| 316 | @param poly A pointer to the relevant tPoly. | ||
| 317 | @param voice The voice to get the pitch of. | ||
| 318 | @return The current pitch of the given voice as a fractional MIDI note number. | ||
| 319 | */ | ||
| 320 | float tPoly_getPitch (tPoly* const poly, uint8_t voice); | ||
| 321 | |||
| 322 | |||
| 323 | //! Get the current MIDI note number of a given voice. | ||
| 324 | /*! | ||
| 325 | @param poly A pointer to the relevant tPoly. | 373 | @param poly A pointer to the relevant tPoly. |
| 326 | @param voice The voice to get the MIDI note number of. | 374 | @param voice The voice to get the MIDI note number of. |
| 327 | @return The MIDI note number of the given voice. | 375 | @return The MIDI note number of the given voice. |
| 328 | */ | 376 | |
| 329 | int tPoly_getKey (tPoly* const poly, uint8_t voice); | 377 | @fn int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice) |
| 330 | 378 | @brief Returns negative one if the voice is inactive | |
| 331 | 379 | ||
| 332 | //! Get the current MIDI velocity of a given voice. | 380 | @fn int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice) |
| 333 | /*! | 381 | @brief Get the current MIDI velocity of a given voice. |
| 334 | @param poly A pointer to the relevant tPoly. | 382 | @param poly A pointer to the relevant tPoly. |
| 335 | @param voice The voice to get the MIDI velocity of. | 383 | @param voice The voice to get the MIDI velocity of. |
| 336 | @return The current MIDI velocity of the given voice. | 384 | @return The current MIDI velocity of the given voice. |
| 337 | */ | 385 | |
| 338 | int tPoly_getVelocity (tPoly* const poly, uint8_t voice); | 386 | @fn int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice) |
| 339 | 387 | @brief Get the current play state of a given voice. | |
| 340 | |||
| 341 | //! Get the current play state of a given voice. | ||
| 342 | /*! | ||
| 343 | @param poly A pointer to the relevant tPoly. | 388 | @param poly A pointer to the relevant tPoly. |
| 344 | @param voice The voice to get the state of. | 389 | @param voice The voice to get the state of. |
| 345 | @return The current play state of the given voice. | 390 | @return The current play state of the given voice. |
| 346 | */ | 391 | |
| 347 | int tPoly_isOn (tPoly* const poly, uint8_t voice); | 392 | @} */ |
| 348 | |||
| 349 | /*! @} */ | ||
| 350 | |||
| 351 | //============================================================================== | ||
| 352 | |||
| 353 | |||
| 354 | /* tPoly */ | ||
| 355 | typedef struct _tSimplePoly | 393 | typedef struct _tSimplePoly |
| 356 | { | 394 | { |
| 357 | tMempool mempool; | 395 | tMempool mempool; |
| @@ -369,116 +407,23 @@ extern "C" { · 11 unmodified lines | |||
| 369 | 407 | ||
| 370 | typedef _tSimplePoly* tSimplePoly; | 408 | typedef _tSimplePoly* tSimplePoly; |
| 371 | 409 | ||
| 372 | //! Initialize a tPoly to the default LEAF mempool. | ||
| 373 | /*! | ||
| 374 | @param poly A pointer to the tPoly to be initialized. | ||
| 375 | @param maxNumVoices The maximum number of voices this tPoly can handle at once. | ||
| 376 | */ | ||
| 377 | void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices); | 410 | void tSimplePoly_init (tSimplePoly* const poly, int maxNumVoices); |
| 378 | |||
| 379 | |||
| 380 | //! Initialize a tPoly to a specified mempool. | ||
| 381 | /*! | ||
| 382 | @param poly A pointer to the tPoly to be initialized. | ||
| 383 | @param pool A pointer to the tMempool to which the tPoly should be initialized. | ||
| 384 | */ | ||
| 385 | void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool); | 411 | void tSimplePoly_initToPool (tSimplePoly* const poly, int maxNumVoices, tMempool* const pool); |
| 386 | |||
| 387 | |||
| 388 | //! Free a tPoly from the default LEAF mempool. | ||
| 389 | /*! | ||
| 390 | @param poly A pointer to the tPoly to be freed. | ||
| 391 | */ | ||
| 392 | void tSimplePoly_free (tSimplePoly* const poly); | 412 | void tSimplePoly_free (tSimplePoly* const poly); |
| 393 | 413 | ||
| 394 | |||
| 395 | //! Add a note with a given velocity to the poly handler. | ||
| 396 | /*! | ||
| 397 | @param poly A pointer to the relevant tPoly. | ||
| 398 | @param note The MIDI note number to add. | ||
| 399 | @param vel The MIDI velocity of the note to add. | ||
| 400 | @return The voice that will play the note. | ||
| 401 | */ | ||
| 402 | int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel); | 414 | int tSimplePoly_noteOn (tSimplePoly* const poly, int note, uint8_t vel); |
| 403 | |||
| 404 | |||
| 405 | //! Remove a note from the poly handler. | ||
| 406 | /*! | ||
| 407 | @param poly A pointer to the relevant tPoly. | ||
| 408 | @param note The MIDI note number to remove. | ||
| 409 | @return The voice that was playing the removed note. | ||
| 410 | */ | ||
| 411 | int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note); | 415 | int tSimplePoly_noteOff (tSimplePoly* const poly, uint8_t note); |
| 412 | 416 | void tSimplePoly_deactivateVoice (tSimplePoly* const polyh, uint8_t voice); | |
| 413 | 417 | int tSimplePoly_markPendingNoteOff (tSimplePoly* const polyh, uint8_t note); | |
| 414 | 418 | int tSimplePoly_findVoiceAssignedToNote (tSimplePoly* const polyh, uint8_t note); | |
| 415 | void tSimplePoly_deactivateVoice(tSimplePoly* const polyh, uint8_t voice); | ||
| 416 | |||
| 417 | int tSimplePoly_markPendingNoteOff(tSimplePoly* const polyh, uint8_t note); | ||
| 418 | |||
| 419 | |||
| 420 | //find if there is a voice with that note -- useful for note offs where you want to wait to remove it from the poly until the release phase of the envelope is finished | ||
| 421 | int tSimplePoly_findVoiceAssignedToNote(tSimplePoly* const polyh, uint8_t note); | ||
| 422 | |||
| 423 | //! Set the number of voices available to play notes. | ||
| 424 | /*! | ||
| 425 | @param poly A pointer to the relevant tPoly. | ||
| 426 | @param numVoices The new number of available voices. Cannot be greater than the max number voices given in tPoly_init(). | ||
| 427 | */ | ||
| 428 | void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices); | 419 | void tSimplePoly_setNumVoices (tSimplePoly* const poly, uint8_t numVoices); |
| 429 | |||
| 430 | //! Set whether pitch glide over note changes in voices is active. | ||
| 431 | /*! | ||
| 432 | @param poly A pointer to the relevant tPoly. | ||
| 433 | @param isActive Whether pitch glide should be active or not. | ||
| 434 | */ | ||
| 435 | |||
| 436 | //! Get the current number of voices available to play notes. | ||
| 437 | /*! | ||
| 438 | @param poly A pointer to the relevant tPoly. | ||
| 439 | @return The current number of voices available to play notes. | ||
| 440 | */ | ||
| 441 | int tSimplePoly_getNumVoices (tSimplePoly* const poly); | 420 | int tSimplePoly_getNumVoices (tSimplePoly* const poly); |
| 442 | |||
| 443 | //! Get the number of voices currently playing notes. | ||
| 444 | /*! | ||
| 445 | @param poly A pointer to the relevant tPoly. | ||
| 446 | @return The number of voices currently playing notes. | ||
| 447 | */ | ||
| 448 | int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly); | 421 | int tSimplePoly_getNumActiveVoices (tSimplePoly* const poly); |
| 449 | 422 | int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice); | |
| 450 | //! Get the current MIDI note number of a given voice. | 423 | int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice); |
| 451 | /*! | ||
| 452 | @param poly A pointer to the relevant tPoly. | ||
| 453 | @param voice The voice to get the MIDI note number of. | ||
| 454 | @return The MIDI note number of the given voice. | ||
| 455 | */ | ||
| 456 | |||
| 457 | int tSimplePoly_getPitch (tSimplePoly* const poly, uint8_t voice); | ||
| 458 | |||
| 459 | |||
| 460 | //this one returns negative one if the voice is inactive | ||
| 461 | int tSimplePoly_getPitchAndCheckActive(tSimplePoly* const polyh, uint8_t voice); | ||
| 462 | |||
| 463 | |||
| 464 | //! Get the current MIDI velocity of a given voice. | ||
| 465 | /*! | ||
| 466 | @param poly A pointer to the relevant tPoly. | ||
| 467 | @param voice The voice to get the MIDI velocity of. | ||
| 468 | @return The current MIDI velocity of the given voice. | ||
| 469 | */ | ||
| 470 | int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice); | 424 | int tSimplePoly_getVelocity (tSimplePoly* const poly, uint8_t voice); |
| 471 | |||
| 472 | |||
| 473 | //! Get the current play state of a given voice. | ||
| 474 | /*! | ||
| 475 | @param poly A pointer to the relevant tPoly. | ||
| 476 | @param voice The voice to get the state of. | ||
| 477 | @return The current play state of the given voice. | ||
| 478 | */ | ||
| 479 | int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice); | 425 | int tSimplePoly_isOn (tSimplePoly* const poly, uint8_t voice); |
| 480 | 426 | ||
| 481 | /*! @} */ | ||
| 482 | //============================================================================== | 427 | //============================================================================== |
| 483 | 428 | ||
| 484 | #ifdef __cplusplus | 429 | #ifdef __cplusplus |
| @@ -33,42 +33,31 @@ extern "C" { · 32 unmodified lines | |||
| 33 | @ingroup oscillators | 33 | @ingroup oscillators |
| 34 | @brief A general wavetable oscillator. | 34 | @brief A general wavetable oscillator. |
| 35 | @{ | 35 | @{ |
| 36 | */ | 36 | |
| 37 | 37 | @fn void tTable_init (tTable* const osc, float* waveTable, int size) | |
| 38 | /*! | ||
| 39 | @fn void tTable_init (tTable* const osc) | ||
| 40 | @brief Initialize a tTable to the default LEAF mempool. | 38 | @brief Initialize a tTable to the default LEAF mempool. |
| 41 | @param osc A pointer to the tTable to be initialized. | 39 | @param osc A pointer to the tTable to be initialized. |
| 42 | */ | 40 | |
| 43 | 41 | @fn void tTable_initToPool (tTable* const osc, float* waveTable, int size, tMempool* const mempool) | |
| 44 | /*! | ||
| 45 | @fn void tTable_initToPool (tTable* const osc, tMempool* const mempool) | ||
| 46 | @brief Initialize a tTable to a specified mempool. | 42 | @brief Initialize a tTable to a specified mempool. |
| 47 | @param osc A pointer to the tTable to be initialized. | 43 | @param osc A pointer to the tTable to be initialized. |
| 48 | @param pool A pointer to the tMempool to which the tTable should be initialized. | 44 | @param pool A pointer to the tMempool to which the tTable should be initialized. |
| 49 | */ | 45 | |
| 50 | |||
| 51 | /*! | ||
| 52 | @fn void tTable_free (tTable* const osc) | 46 | @fn void tTable_free (tTable* const osc) |
| 53 | @brief Free a tTable from the default LEAF mempool. | 47 | @brief Free a tTable from the default LEAF mempool. |
| 54 | @param osc A pointer to the tTable to be freed. | 48 | @param osc A pointer to the tTable to be freed. |
| 55 | */ | 49 | |
| 56 | |||
| 57 | /*! | ||
| 58 | @fn float tTable_tick (tTable* const osc) | 50 | @fn float tTable_tick (tTable* const osc) |
| 59 | @brief Tick a tTable oscillator. | 51 | @brief Tick a tTable oscillator. |
| 60 | @param osc A pointer to the relevant tTable. | 52 | @param osc A pointer to the relevant tTable. |
| 61 | @return The ticked sample as a float from -1 to 1. | 53 | @return The ticked sample as a float from -1 to 1. |
| 62 | */ | 54 | |
| 63 | |||
| 64 | /*! | ||
| 65 | @fn void tTable_setFreq (tTable* const osc, float freq) | 55 | @fn void tTable_setFreq (tTable* const osc, float freq) |
| 66 | @brief Set the frequency of a tTable oscillator. | 56 | @brief Set the frequency of a tTable oscillator. |
| 67 | @param osc A pointer to the relevant tTable. | 57 | @param osc A pointer to the relevant tTable. |
| 68 | @param freq The frequency to set the oscillator to. | 58 | @param freq The frequency to set the oscillator to. |
| 69 | */ | 59 | |
| 70 | 60 | @} */ | |
| 71 | /*! @} */ | ||
| 72 | 61 | ||
| 73 | typedef struct _tTable | 62 | typedef struct _tTable |
| 74 | { | 63 | { |
| @@ -96,42 +85,32 @@ extern "C" { · 21 unmodified lines | |||
| 96 | @ingroup oscillators | 85 | @ingroup oscillators |
| 97 | @brief A cycle/sine waveform oscillator. Uses wavetable synthesis. | 86 | @brief A cycle/sine waveform oscillator. Uses wavetable synthesis. |
| 98 | @{ | 87 | @{ |
| 99 | */ | 88 | |
| 100 | |||
| 101 | /*! | ||
| 102 | @fn void tCycle_init (tCycle* const osc) | 89 | @fn void tCycle_init (tCycle* const osc) |
| 103 | @brief Initialize a tCycle to the default LEAF mempool. | 90 | @brief Initialize a tCycle to the default LEAF mempool. |
| 104 | @param osc A pointer to the tCycle to be initialized. | 91 | @param osc A pointer to the tCycle to be initialized. |
| 105 | */ | 92 | |
| 106 | |||
| 107 | /*! | ||
| 108 | @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool) | 93 | @fn void tCycle_initToPool (tCycle* const osc, tMempool* const pool) |
| 109 | @brief Initialize a tCycle to a specified mempool. | 94 | @brief Initialize a tCycle to a specified mempool. |
| 110 | @param osc A pointer to the tCycle to be initialized. | 95 | @param osc A pointer to the tCycle to be initialized. |
| 111 | @param pool A pointer to the tMempool to which the tCycle should be initialized. | 96 | @param pool A pointer to the tMempool to which the tCycle should be initialized. |
| 112 | */ | 97 | |
| 113 | |||
| 114 | /*! | ||
| 115 | @fn void tCycle_free (tCycle* const osc) | 98 | @fn void tCycle_free (tCycle* const osc) |
| 116 | @brief Free a tCycle from the default LEAF mempool. | 99 | @brief Free a tCycle from the default LEAF mempool. |
| 117 | @param osc A pointer to the tCycle to be freed. | 100 | @param osc A pointer to the tCycle to be freed. |
| 118 | */ | 101 | |
| 119 | |||
| 120 | /*! | ||
| 121 | @fn float tCycle_tick (tCycle* const osc) | 102 | @fn float tCycle_tick (tCycle* const osc) |
| 122 | @brief Tick a tCycle oscillator. | 103 | @brief Tick a tCycle oscillator. |
| 123 | @param osc A pointer to the relevant tCycle. | 104 | @param osc A pointer to the relevant tCycle. |
| 124 | @return The ticked sample as a float from -1 to 1. | 105 | @return The ticked sample as a float from -1 to 1. |
| 125 | */ | 106 | |
| 126 | |||
| 127 | /*! | ||
| 128 | @fn void tCycle_setFreq (tCycle* const osc, float freq) | 107 | @fn void tCycle_setFreq (tCycle* const osc, float freq) |
| 129 | @brief Set the frequency of a tCycle oscillator. | 108 | @brief Set the frequency of a tCycle oscillator. |
| 130 | @param osc A pointer to the relevant tCycle. | 109 | @param osc A pointer to the relevant tCycle. |
| 131 | @param freq The frequency to set the oscillator to. | 110 | @param freq The frequency to set the oscillator to. |
| 132 | */ | 111 | |
| 133 | 112 |  | |
| 134 | /*! @} */ | 113 | @} */ |
| 135 | 114 | ||
| 136 | typedef struct _tCycle | 115 | typedef struct _tCycle |
| 137 | { | 116 | { |
| @@ -157,42 +136,31 @@ extern "C" { · 19 unmodified lines | |||
| 157 | @ingroup oscillators | 136 | @ingroup oscillators |
| 158 | @brief Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components. | 137 | @brief Anti-aliased Triangle waveform using wavetable interpolation. Wavetables constructed from sine components. |
| 159 | @{ | 138 | @{ |
| 160 | */ | 139 | |
| 161 | |||
| 162 | /*! | ||
| 163 | @fn void tTriangle_init (tTriangle* const osc) | 140 | @fn void tTriangle_init (tTriangle* const osc) |
| 164 | @brief Initialize a tTriangle to the default LEAF mempool. | 141 | @brief Initialize a tTriangle to the default LEAF mempool. |
| 165 | @param osc A pointer to the tTriangle to be initialized. | 142 | @param osc A pointer to the tTriangle to be initialized. |
| 166 | */ | 143 | |
| 167 | |||
| 168 | /*! | ||
| 169 | @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool) | 144 | @fn void tTriangle_initToPool (tTriangle* const osc, tMempool* const pool) |
| 170 | @brief Initialize a tTriangle to a specified mempool. | 145 | @brief Initialize a tTriangle to a specified mempool. |
| 171 | @param osc A pointer to the tTriangle to be initialized. | 146 | @param osc A pointer to the tTriangle to be initialized. |
| 172 | @param pool A pointer to the tMempool to which the tTriangle should be initialized. | 147 | @param pool A pointer to the tMempool to which the tTriangle should be initialized. |
| 173 | */ | 148 | |
| 174 | |||
| 175 | /*! | ||
| 176 | @fn void tTriangle_free (tTriangle* const osc) | 149 | @fn void tTriangle_free (tTriangle* const osc) |
| 177 | @brief Free a tTriangle from the default LEAF mempool. | 150 | @brief Free a tTriangle from the default LEAF mempool. |
| 178 | @param osc A pointer to the tTriangle to be freed. | 151 | @param osc A pointer to the tTriangle to be freed. |
| 179 | */ | 152 | |
| 180 | |||
| 181 | /*! | ||
| 182 | @fn float tTriangle_tick (tTriangle* const osc) | 153 | @fn float tTriangle_tick (tTriangle* const osc) |
| 183 | @brief Tick a tTriangle oscillator. | 154 | @brief Tick a tTriangle oscillator. |
| 184 | @param osc A pointer to the relevant tTriangle. | 155 | @param osc A pointer to the relevant tTriangle. |
| 185 | @return The ticked sample as a float from -1 to 1. | 156 | @return The ticked sample as a float from -1 to 1. |
| 186 | */ | 157 | |
| 187 | |||
| 188 | /*! | ||
| 189 | @fn void tTriangle_setFreq (tTriangle* const osc, float freq) | 158 | @fn void tTriangle_setFreq (tTriangle* const osc, float freq) |
| 190 | @brief Set the frequency of a tTriangle oscillator. | 159 | @brief Set the frequency of a tTriangle oscillator. |
| 191 | @param osc A pointer to the relevant tTriangle. | 160 | @param osc A pointer to the relevant tTriangle. |
| 192 | @param freq The frequency to set the oscillator to. | 161 | @param freq The frequency to set the oscillator to. |
| 193 | */ | 162 | |
| 194 | 163 | @} */ | |
| 195 | /*! @} */ | ||
| 196 | 164 | ||
| 197 | typedef struct _tTriangle | 165 | typedef struct _tTriangle |
| 198 | { | 166 | { |
| @@ -221,42 +189,31 @@ extern "C" { · 22 unmodified lines | |||
| 221 | @ingroup oscillators | 189 | @ingroup oscillators |
| 222 | @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components. | 190 | @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components. |
| 223 | @{ | 191 | @{ |
| 224 | */ | 192 | |
| 225 | |||
| 226 | /*! | ||
| 227 | @fn void tSquare_init (tSquare* const osc) | 193 | @fn void tSquare_init (tSquare* const osc) |
| 228 | @brief Initialize a tSquare to the default LEAF mempool. | 194 | @brief Initialize a tSquare to the default LEAF mempool. |
| 229 | @param osc A pointer to the tSquare to be initialized. | 195 | @param osc A pointer to the tSquare to be initialized. |
| 230 | */ | 196 | |
| 231 | |||
| 232 | /*! | ||
| 233 | @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool) | 197 | @fn void tSquare_initToPool (tSquare* const osc, tMempool* const pool) |
| 234 | @brief Initialize a tSquare to a specified mempool. | 198 | @brief Initialize a tSquare to a specified mempool. |
| 235 | @param osc A pointer to the tSquare to be initialized. | 199 | @param osc A pointer to the tSquare to be initialized. |
| 236 | @param pool A pointer to the tMempool to which the tSquare should be initialized. | 200 | @param pool A pointer to the tMempool to which the tSquare should be initialized. |
| 237 | */ | 201 | |
| 238 | |||
| 239 | /*! | ||
| 240 | @fn void tSquare_free (tSquare* const osc) | 202 | @fn void tSquare_free (tSquare* const osc) |
| 241 | @brief Free a tSquare from the default LEAF mempool. | 203 | @brief Free a tSquare from the default LEAF mempool. |
| 242 | @param osc A pointer to the tSquare to be freed. | 204 | @param osc A pointer to the tSquare to be freed. |
| 243 | */ | 205 | |
| 244 | |||
| 245 | /*! | ||
| 246 | @fn float tSquare_tick (tSquare* const osc) | 206 | @fn float tSquare_tick (tSquare* const osc) |
| 247 | @brief Tick a tSquare oscillator. | 207 | @brief Tick a tSquare oscillator. |
| 248 | @param osc A pointer to the relevant tSquare. | 208 | @param osc A pointer to the relevant tSquare. |
| 249 | @return The ticked sample as a float from -1 to 1. | 209 | @return The ticked sample as a float from -1 to 1. |
| 250 | */ | 210 | |
| 251 | |||
| 252 | /*! | ||
| 253 | @fn void tSquare_setFreq (tSquare* const osc, float freq) | 211 | @fn void tSquare_setFreq (tSquare* const osc, float freq) |
| 254 | @brief Set the frequency of a tSquare oscillator. | 212 | @brief Set the frequency of a tSquare oscillator. |
| 255 | @param osc A pointer to the relevant tSquare. | 213 | @param osc A pointer to the relevant tSquare. |
| 256 | @param freq The frequency to set the oscillator to. | 214 | @param freq The frequency to set the oscillator to. |
| 257 | */ | 215 |  |
| 258 | 216 | @} */ | |
| 259 | /*! @} */ | ||
| 260 | 217 | ||
| 261 | typedef struct _tSquare | 218 | typedef struct _tSquare |
| 262 | { | 219 | { |
| @@ -277,7 +234,8 @@ extern "C" { · 14 unmodified lines | |||
| 277 | float tSquare_tick (tSquare* const osc); | 234 | float tSquare_tick (tSquare* const osc); |
| 278 | void tSquare_setFreq (tSquare* const osc, float freq); | 235 | void tSquare_setFreq (tSquare* const osc, float freq); |
| 279 | 236 | ||
| 280 | /*! @} */ | 237 | /*! |
| 238 | @} */ | ||
| 281 | 239 | ||
| 282 | //============================================================================== | 240 | //============================================================================== |
| 283 | 241 | ||
| @@ -286,42 +244,31 @@ extern "C" { · 2 unmodified lines | |||
| 286 | @ingroup oscillators | 244 | @ingroup oscillators |
| 287 | @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components. | 245 | @brief Anti-aliased Square waveform using wavetable interpolation. Wavetables constructed from sine components. |
| 288 | @{ | 246 | @{ |
| 289 | */ | 247 | |
| 290 | |||
| 291 | /*! | ||
| 292 | @fn void tSawtooth_init (tSawtooth* const osc) | 248 | @fn void tSawtooth_init (tSawtooth* const osc) |
| 293 | @brief Initialize a tSawtooth to the default LEAF mempool. | 249 | @brief Initialize a tSawtooth to the default LEAF mempool. |
| 294 | @param osc A pointer to the tSawtooth to be initialized. | 250 | @param osc A pointer to the tSawtooth to be initialized. |
| 295 | */ | 251 | |
| 296 | |||
| 297 | /*! | ||
| 298 | @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool) | 252 | @fn void tSawtooth_initToPool (tSawtooth* const osc, tMempool* const pool) |
| 299 | @brief Initialize a tSawtooth to a specified mempool. | 253 | @brief Initialize a tSawtooth to a specified mempool. |
| 300 | @param osc A pointer to the tSawtooth to be initialized. | 254 | @param osc A pointer to the tSawtooth to be initialized. |
| 301 | @param pool A pointer to the tMempool to which the tSawtooth should be initialized. | 255 | @param pool A pointer to the tMempool to which the tSawtooth should be initialized. |
| 302 | */ | 256 | |
| 303 | |||
| 304 | /*! | ||
| 305 | @fn void tSawtooth_free (tSawtooth* const osc) | 257 | @fn void tSawtooth_free (tSawtooth* const osc) |
| 306 | @brief Free a tSawtooth from the default LEAF mempool. | 258 | @brief Free a tSawtooth from the default LEAF mempool. |
| 307 | @param osc A pointer to the tSawtooth to be freed. | 259 | @param osc A pointer to the tSawtooth to be freed. |
| 308 | */ | 260 | |
| 309 | |||
| 310 | /*! | ||
| 311 | @fn float tSawtooth_tick (tSawtooth* const osc) | 261 | @fn float tSawtooth_tick (tSawtooth* const osc) |
| 312 | @brief Tick a tSawtooth oscillator. | 262 | @brief Tick a tSawtooth oscillator. |
| 313 | @param osc A pointer to the relevant tSawtooth. | 263 | @param osc A pointer to the relevant tSawtooth. |
| 314 | @return The ticked sample as a float from -1 to 1. | 264 | @return The ticked sample as a float from -1 to 1. |
| 315 | */ | 265 | |
| 316 | |||
| 317 | /*! | ||
| 318 | @fn void tSawtooth_setFreq (tSawtooth* const osc, float freq) | 266 | @fn void tSawtooth_setFreq (tSawtooth* const osc, float freq) |
| 319 | @brief Set the frequency of a tSawtooth oscillator. | 267 | @brief Set the frequency of a tSawtooth oscillator. |
| 320 | @param osc A pointer to the relevant tSawtooth. | 268 | @param osc A pointer to the relevant tSawtooth. |
| 321 | @param freq The frequency to set the oscillator to. | 269 | @param freq The frequency to set the oscillator to. |
| 322 | */ | 270 |  |
| 323 | 271 | @} */ | |
| 324 | /*! @} */ | ||
| 325 | 272 | ||
| 326 | typedef struct _tSawtooth | 273 | typedef struct _tSawtooth |
| 327 | { | 274 | { |
| @@ -344,72 +291,37 @@ extern "C" { · 16 unmodified lines | |||
| 344 | 291 | ||
| 345 | //============================================================================== | 292 | //============================================================================== |
| 346 | 293 | ||
| 347 | |||
| 348 | // TO BE REMOVED | ||
| 349 | typedef struct _tSine | ||
| 350 | { | ||
| 351 | tMempool mempool; | ||
| 352 | float* sine; | ||
| 353 | int size; | ||
| 354 | float phase; | ||
| 355 | float inc,freq; | ||
| 356 | } _tSine; | ||
| 357 | |||
| 358 | typedef _tSine* tSine; | ||
| 359 | |||
| 360 | void tSine_init (tSine* const osc, int size); | ||
| 361 | void tSine_initToPool (tSine* const osc, int size, tMempool* const pool); | ||
| 362 | |||
| 363 | void tSine_free (tSine* const osc); | ||
| 364 | float tSine_tick (tSine* const osc); | ||
| 365 | void tSine_setFreq (tSine* const osc, float freq); | ||
| 366 | |||
| 367 | //============================================================================== | ||
| 368 | |||
| 369 | /*! | 294 | /*! |
| 370 | @defgroup ttri tTri | 295 | @defgroup ttri tTri |
| 371 | @ingroup oscillators | 296 | @ingroup oscillators |
| 372 | @brief | 297 | @brief |
| 373 | @{ | 298 | @{ |
| 374 | */ | 299 | |
| 375 | |||
| 376 | /*! | ||
| 377 | @fn void tTri_init (tTri* const osc) | 300 | @fn void tTri_init (tTri* const osc) |
| 378 | @brief | 301 | @brief |
| 379 | @param | 302 | @param |
| 380 | */ | 303 | |
| 381 | |||
| 382 | /*! | ||
| 383 | @fn void tTri_initToPool (tTri* const osc, tMempool* const pool) | 304 | @fn void tTri_initToPool (tTri* const osc, tMempool* const pool) |
| 384 | @brief | 305 | @brief |
| 385 | @param | 306 | @param |
| 386 | */ | 307 | |
| 387 | |||
| 388 | /*! | ||
| 389 | @fn void tTri_free (tTri* const osc) | 308 | @fn void tTri_free (tTri* const osc) |
| 390 | @brief | 309 | @brief |
| 391 | @param | 310 | @param |
| 392 | */ | 311 | |
| 393 | |||
| 394 | /*! | ||
| 395 | @fn float tTri_tick (tTri* const osc) | 312 | @fn float tTri_tick (tTri* const osc) |
| 396 | @brief | 313 | @brief |
| 397 | @param | 314 | @param |
| 398 | */ | 315 | |
| 399 | |||
| 400 | /*! | ||
| 401 | @fn void tTri_setFreq (tTri* const osc, float freq) | 316 | @fn void tTri_setFreq (tTri* const osc, float freq) |
| 402 | @brief | 317 | @brief |
| 403 | @param | 318 | @param |
| 404 | */ | 319 | |
| 405 | |||
| 406 | /*! | ||
| 407 | @fn void tTri_setSkew (tTri* const osc, float skew) | 320 | @fn void tTri_setSkew (tTri* const osc, float skew) |
| 408 | @brief | 321 | @brief |
| 409 | @param | 322 | @param |
| 410 | */ | 323 |  |
| 411 | 324 | @} */ | |
| 412 | /*! @} */ | ||
| 413 | 325 | ||
| 414 | typedef struct _tTri | 326 | typedef struct _tTri |
| 415 | { | 327 | { |
| @@ -437,45 +349,32 @@ extern "C" { · 21 unmodified lines | |||
| 437 | @ingroup oscillators | 349 | @ingroup oscillators |
| 438 | @brief | 350 | @brief |
| 439 | @{ | 351 | @{ |
| 440 | */ | 352 | |
| 441 | |||
| 442 | /*! | ||
| 443 | @fn void tPulse_init (tPulse* const osc) | 353 | @fn void tPulse_init (tPulse* const osc) |
| 444 | @brief | 354 | @brief |
| 445 | @param | 355 | @param |
| 446 | */ | 356 | |
| 447 | |||
| 448 | /*! | ||
| 449 | @fn void tPulse_initToPool (tPulse* const osc, tMempool* const) | 357 | @fn void tPulse_initToPool (tPulse* const osc, tMempool* const) |
| 450 | @brief | 358 | @brief |
| 451 | @param | 359 | @param |
| 452 | */ | 360 | |
| 453 | |||
| 454 | /*! | ||
| 455 | @fn void tPulse_free (tPulse* const osc) | 361 | @fn void tPulse_free (tPulse* const osc) |
| 456 | @brief | 362 | @brief |
| 457 | @param | 363 | @param |
| 458 | */ | 364 | |
| 459 | |||
| 460 | /*! | ||
| 461 | @fn float tPulse_tick (tPulse* const osc) | 365 | @fn float tPulse_tick (tPulse* const osc) |
| 462 | @brief | 366 | @brief |
| 463 | @param | 367 | @param |
| 464 | */ | 368 | |
| 465 | |||
| 466 | /*! | ||
| 467 | @fn void tPulse_setFreq (tPulse* const osc, float freq) | 369 | @fn void tPulse_setFreq (tPulse* const osc, float freq) |
| 468 | @brief | 370 | @brief |
| 469 | @param | 371 | @param |
| 470 | */ | 372 | |
| 471 | |||
| 472 | /*! | ||
| 473 | @fn void tPulse_setWidth (tPulse* const osc, float width) | 373 | @fn void tPulse_setWidth (tPulse* const osc, float width) |
| 474 | @brief | 374 | @brief |
| 475 | @param | 375 | @param |
| 476 | */ | 376 |  |
| 477 | 377 | @} */ | |
| 478 | /*! @} */ | ||
| 479 | 378 | ||
| 480 | typedef struct _tPulse | 379 | typedef struct _tPulse |
| 481 | { | 380 | { |
| @@ -502,39 +401,28 @@ extern "C" { · 20 unmodified lines | |||
| 502 | @ingroup oscillators | 401 | @ingroup oscillators |
| 503 | @brief | 402 | @brief |
| 504 | @{ | 403 | @{ |
| 505 | */ | 404 | |
| 506 | |||
| 507 | /*! | ||
| 508 | @fn void tSaw_init (tSaw* const osc) | 405 | @fn void tSaw_init (tSaw* const osc) |
| 509 | @brief | 406 | @brief |
| 510 | @param | 407 | @param |
| 511 | */ | ||
| 512 | 408 | ||
| 513 | /*! | ||
| 514 | @fn void tSaw_initToPool (tSaw* const osc, tMempool* const pool) | 409 | @fn void tSaw_initToPool (tSaw* const osc, tMempool* const pool) |
| 515 | @brief | 410 | @brief |
| 516 | @param | 411 | @param |
| 517 | */ | 412 | |
| 518 | |||
| 519 | /*! | ||
| 520 | @fn void tSaw_free (tSaw* const osc) | 413 | @fn void tSaw_free (tSaw* const osc) |
| 521 | @brief | 414 | @brief |
| 522 | @param | 415 | @param |
| 523 | */ | 416 | |
| 524 | |||
| 525 | /*! | ||
| 526 | @fn float tSaw_tick (tSaw* const osc) | 417 | @fn float tSaw_tick (tSaw* const osc) |
| 527 | @brief | 418 | @brief |
| 528 | @param | 419 | @param |
| 529 | */ | 420 | |
| 530 | |||
| 531 | /*! | ||
| 532 | @fn void tSaw_setFreq (tSaw* const osc, float freq) | 421 | @fn void tSaw_setFreq (tSaw* const osc, float freq) |
| 533 | @brief | 422 | @brief |
| 534 | @param | 423 | @param |
| 535 | */ | 424 |  |
| 536 | 425 | @} */ | |
| 537 | /*! @} */ | ||
| 538 | 426 | ||
| 539 | typedef struct _tSaw | 427 | typedef struct _tSaw |
| 540 | { | 428 | { |
| @@ -559,39 +447,28 @@ extern "C" { · 18 unmodified lines | |||
| 559 | @ingroup oscillators | 447 | @ingroup oscillators |
| 560 | @brief | 448 | @brief |
| 561 | @{ | 449 | @{ |
| 562 | */ | 450 | |
| 563 | |||
| 564 | /*! | ||
| 565 | @fn void tPhasor_init (tPhasor* const osc) | 451 | @fn void tPhasor_init (tPhasor* const osc) |
| 566 | @brief | 452 | @brief |
| 567 | @param | 453 | @param |
| 568 | */ | 454 | |
| 569 | |||
| 570 | /*! | ||
| 571 | @fn void tPhasor_initToPool (tPhasor* const osc, tMempool* const) | 455 | @fn void tPhasor_initToPool (tPhasor* const osc, tMempool* const) |
| 572 | @brief | 456 | @brief |
| 573 | @param | 457 | @param |
| 574 | */ | 458 | |
| 575 | |||
| 576 | /*! | ||
| 577 | @fn void tPhasor_free (tPhasor* const osc) | 459 | @fn void tPhasor_free (tPhasor* const osc) |
| 578 | @brief | 460 | @brief |
| 579 | @param | 461 | @param |
| 580 | */ | 462 | |
| 581 | |||
| 582 | /*! | ||
| 583 | @fn float tPhasor_tick (tPhasor* const osc) | 463 | @fn float tPhasor_tick (tPhasor* const osc) |
| 584 | @brief | 464 | @brief |
| 585 | @param | 465 | @param |
| 586 | */ | 466 | |
| 587 | |||
| 588 | /*! | ||
| 589 | @fn void tPhasor_setFreq (tPhasor* const osc, float freq) | 467 | @fn void tPhasor_setFreq (tPhasor* const osc, float freq) |
| 590 | @brief | 468 | @brief |
| 591 | @param | 469 | @param |
| 592 | */ | 470 |  |
| 593 | 471 | @} */ | |
| 594 | /*! @} */ | ||
| 595 | 472 | ||
| 596 | typedef struct _tPhasor | 473 | typedef struct _tPhasor |
| 597 | { | 474 | { |
| @@ -617,27 +494,19 @@ extern "C" { · 19 unmodified lines | |||
| 617 | @ingroup oscillators | 494 | @ingroup oscillators |
| 618 | @brief | 495 | @brief |
| 619 | @{ | 496 | @{ |
| 620 | */ | 497 | |
| 621 | |||
| 622 | /*! | ||
| 623 | @fn void tNoise_init (tNoise* const noise, NoiseType type) | 498 | @fn void tNoise_init (tNoise* const noise, NoiseType type) |
| 624 | @brief | 499 | @brief |
| 625 | @param | 500 | @param |
| 626 | */ | 501 | |
| 627 | |||
| 628 | /*! | ||
| 629 | @fn void tNoise_initToPool (tNoise* const noise, NoiseType type, tMempool* const) | 502 | @fn void tNoise_initToPool (tNoise* const noise, NoiseType type, tMempool* const) |
| 630 | @brief | 503 | @brief |
| 631 | @param | 504 | @param |
| 632 | */ | 505 | |
| 633 | |||
| 634 | /*! | ||
| 635 | @fn void tNoise_free (tNoise* const noise) | 506 | @fn void tNoise_free (tNoise* const noise) |
| 636 | @brief | 507 | @brief |
| 637 | @param | 508 | @param |
| 638 | */ | 509 | |
| 639 | |||
| 640 | /*! | ||
| 641 | @fn float tNoise_tick (tNoise* const noise) | 510 | @fn float tNoise_tick (tNoise* const noise) |
| 642 | @brief | 511 | @brief |
| 643 | @param | 512 | @param |
| @@ -654,7 +523,7 @@ extern "C" { · 10 unmodified lines | |||
| 654 | NoiseTypeNil, | 523 | NoiseTypeNil, |
| 655 | }; | 524 | }; |
| 656 | 525 | ||
| 657 | /*! @} */ | 526 | /*! @} */ |
| 658 | 527 | ||
| 659 | typedef enum NoiseType NoiseType; | 528 | typedef enum NoiseType NoiseType; |
| 660 | 529 | ||
| @@ -681,111 +550,79 @@ extern "C" { · 20 unmodified lines | |||
| 681 | @ingroup oscillators | 550 | @ingroup oscillators |
| 682 | @brief A model of a neuron, adapted to act as an oscillator. | 551 | @brief A model of a neuron, adapted to act as an oscillator. |
| 683 | @{ | 552 | @{ |
| 684 | */ | 553 | |
| 685 | |||
| 686 | /*! | ||
| 687 | @fn void tNeuron_init (tNeuron* const neuron) | 554 | @fn void tNeuron_init (tNeuron* const neuron) |
| 688 | @brief Initialize a tNeuron to the default LEAF mempool. | 555 | @brief Initialize a tNeuron to the default LEAF mempool. |
| 689 | @param neuron A pointer to the tNeuron to be initialized. | 556 | @param neuron A pointer to the tNeuron to be initialized. |
| 690 | */ | 557 | |
| 691 | |||
| 692 | /*! | ||
| 693 | @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool) | 558 | @fn void tNeuron_initToPool (tNeuron* const neuron, tMempool* const pool) |
| 694 | @brief Initialize a tNeuron to a specified mempool. | 559 | @brief Initialize a tNeuron to a specified mempool. |
| 695 | @param neuron A pointer to the tNeuron to be initialized. | 560 | @param neuron A pointer to the tNeuron to be initialized. |
| 696 | @param pool A pointer to the tMempool to which the tNeuron should be initialized. | 561 | @param pool A pointer to the tMempool to which the tNeuron should be initialized. |
| 697 | */ | 562 | |
| 698 | |||
| 699 | /*! | ||
| 700 | @fn void tNeuron_free (tNeuron* const neuron) | 563 | @fn void tNeuron_free (tNeuron* const neuron) |
| 701 | @brief Free a tNeuron from the default LEAF mempool. | 564 | @brief Free a tNeuron from the default LEAF mempool. |
| 702 | @param neuron A pointer to the tNeuron to be freed. | 565 | @param neuron A pointer to the tNeuron to be freed. |
| 703 | */ | 566 | |
| 704 | |||
| 705 | /*! | ||
| 706 | @fn void tNeuron_reset (tNeuron* const neuron) | 567 | @fn void tNeuron_reset (tNeuron* const neuron) |
| 707 | @brief Reset the neuron model. | 568 | @brief Reset the neuron model. |
| 708 | @param neuron A pointer to the relevant tNeuron. | 569 | @param neuron A pointer to the relevant tNeuron. |
| 709 | */ | 570 | |
| 710 | |||
| 711 | /*! | ||
| 712 | @fn float tNeuron_tick (tNeuron* const neuron) | 571 | @fn float tNeuron_tick (tNeuron* const neuron) |
| 713 | @brief Tick a tNeuron oscillator. | 572 | @brief Tick a tNeuron oscillator. |
| 714 | @param neuron A pointer to the relevant tNeuron. | 573 | @param neuron A pointer to the relevant tNeuron. |
| 715 | @return The ticked sample as a float from -1 to 1. | 574 | @return The ticked sample as a float from -1 to 1. |
| 716 | */ | 575 | |
| 717 | |||
| 718 | /*! | ||
| 719 | @fn void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode) | 576 | @fn void tNeuron_setMode (tNeuron* const neuron, NeuronMode mode) |
| 720 | @brief Set the tNeuron shaping mode. | 577 | @brief Set the tNeuron shaping mode. |
| 721 | @param neuron A pointer to the relevant tNeuron. | 578 | @param neuron A pointer to the relevant tNeuron. |
| 722 | @param mode The mode to set the tNeuron to. | 579 | @param mode The mode to set the tNeuron to. |
| 723 | */ | 580 | |
| 724 | |||
| 725 | /*! | ||
| 726 | @fn void tNeuron_setCurrent (tNeuron* const neuron, float current) | 581 | @fn void tNeuron_setCurrent (tNeuron* const neuron, float current) |
| 727 | @brief Set the current. | 582 | @brief Set the current. |
| 728 | @param neuron A pointer to the relevant tNeuron. | 583 | @param neuron A pointer to the relevant tNeuron. |
| 729 | @param current The new current. | 584 | @param current The new current. |
| 730 | */ | 585 | |
| 731 | |||
| 732 | /*! | ||
| 733 | @fn void tNeuron_setK (tNeuron* const neuron, float K) | 586 | @fn void tNeuron_setK (tNeuron* const neuron, float K) |
| 734 | @brief Set the potassium value. | 587 | @brief Set the potassium value. |
| 735 | @param neuron A pointer to the relevant tNeuron. | 588 | @param neuron A pointer to the relevant tNeuron. |
| 736 | @param K The new potassium. | 589 | @param K The new potassium. |
| 737 | */ | 590 | |
| 738 | |||
| 739 | /*! | ||
| 740 | @fn void tNeuron_setL (tNeuron* const neuron, float L) | 591 | @fn void tNeuron_setL (tNeuron* const neuron, float L) |
| 741 | @brief Set the chloride value. | 592 | @brief Set the chloride value. |
| 742 | @param neuron A pointer to the relevant tNeuron. | 593 | @param neuron A pointer to the relevant tNeuron. |
| 743 | @param L The new chloride value. | 594 | @param L The new chloride value. |
| 744 | */ | 595 | |
| 745 | |||
| 746 | /*! | ||
| 747 | @fn void tNeuron_setN (tNeuron* const neuron, float N) | 596 | @fn void tNeuron_setN (tNeuron* const neuron, float N) |
| 748 | @brief Set the sodium value. | 597 | @brief Set the sodium value. |
| 749 | @param neuron A pointer to the relevant tNeuron. | 598 | @param neuron A pointer to the relevant tNeuron. |
| 750 | @param N The new sodium value. | 599 | @param N The new sodium value. |
| 751 | */ | 600 | |
| 752 | |||
| 753 | /*! | ||
| 754 | @fn void tNeuron_setC (tNeuron* const neuron, float C) | 601 | @fn void tNeuron_setC (tNeuron* const neuron, float C) |
| 755 | @brief Set the calcium value. | 602 | @brief Set the calcium value. |
| 756 | @param neuron A pointer to the relevant tNeuron. | 603 | @param neuron A pointer to the relevant tNeuron. |
| 757 | @param C The new calcium. | 604 | @param C The new calcium. |
| 758 | */ | 605 | |
| 759 | |||
| 760 | /*! | ||
| 761 | @fn void tNeuron_setV1 (tNeuron* const neuron, float V1) | 606 | @fn void tNeuron_setV1 (tNeuron* const neuron, float V1) |
| 762 | @brief Set the V1 value. | 607 | @brief Set the V1 value. |
| 763 | @param neuron A pointer to the relevant tNeuron. | 608 | @param neuron A pointer to the relevant tNeuron. |
| 764 | @param V1 The new V1. | 609 | @param V1 The new V1. |
| 765 | */ | 610 | |
| 766 | |||
| 767 | /*! | ||
| 768 | @fn void tNeuron_setV2 (tNeuron* const neuron, float V2) | 611 | @fn void tNeuron_setV2 (tNeuron* const neuron, float V2) |
| 769 | @brief Set the V2 value. | 612 | @brief Set the V2 value. |
| 770 | @param neuron A pointer to the relevant tNeuron. | 613 | @param neuron A pointer to the relevant tNeuron. |
| 771 | @param V2 The new V2. | 614 | @param V2 The new V2. |
| 772 | */ | 615 | |
| 773 | |||
| 774 | /*! | ||
| 775 | @fn void tNeuron_setV3 (tNeuron* const neuron, float V3) | 616 | @fn void tNeuron_setV3 (tNeuron* const neuron, float V3) |
| 776 | @brief Set the V3 value. | 617 | @brief Set the V3 value. |
| 777 | @param neuron A pointer to the relevant tNeuron. | 618 | @param neuron A pointer to the relevant tNeuron. |
| 778 | @param V3 The new V3. | 619 | @param V3 The new V3. |
| 779 | */ | 620 | |
| 780 | |||
| 781 | /*! | ||
| 782 | @fn void tNeuron_setTimeStep (tNeuron* const neuron, float timestep) | 621 | @fn void tNeuron_setTimeStep (tNeuron* const neuron, float timestep) |
| 783 | @brief Set the time step of the model. | 622 | @brief Set the time step of the model. |
| 784 | @param neuron A pointer to the relevant tNeuron. | 623 | @param neuron A pointer to the relevant tNeuron. |
| 785 | @param timestep The new time step. | 624 | @param timestep The new time step. |
| 786 | */ | 625 | |
| 787 | |||
| 788 | /*! | ||
| 789 | @brief Shaping modes for tNeuron output. | 626 | @brief Shaping modes for tNeuron output. |
| 790 | */ | 627 | */ |
| 791 | enum NeuronMode | 628 | enum NeuronMode |
| @@ -796,7 +633,7 @@ extern "C" { · 4 unmodified lines | |||
| 796 | NeuronModeNil | 633 | NeuronModeNil |
| 797 | }; | 634 | }; |
| 798 | 635 | ||
| 799 | /*! @} */ | 636 | /*! @} */ |
| 800 | 637 | ||
| 801 | typedef enum NeuronMode NeuronMode; | 638 | typedef enum NeuronMode NeuronMode; |
| 802 | 639 | ||
| @@ -850,57 +687,40 @@ extern "C" { · 47 unmodified lines | |||
| 850 | @ingroup oscillators | 687 | @ingroup oscillators |
| 851 | @brief | 688 | @brief |
| 852 | @{ | 689 | @{ |
| 853 | */ | 690 | |
| 854 | |||
| 855 | /*! | ||
| 856 | @fn void tMBPulse_init(tMBPulse* const osc) | 691 | @fn void tMBPulse_init(tMBPulse* const osc) |
| 857 | @brief | 692 | @brief |
| 858 | @param | 693 | @param |
| 859 | */ | 694 | |
| 860 | |||
| 861 | /*! | ||
| 862 | @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool) | 695 | @fn void tMBPulse_initToPool(tMBPulse* const osc, tMempool* const pool) |
| 863 | @brief | 696 | @brief |
| 864 | @param | 697 | @param |
| 865 | */ | 698 | |
| 866 | |||
| 867 | /*! | ||
| 868 | @fn void tMBPulse_free(tMBPulse* const osc) | 699 | @fn void tMBPulse_free(tMBPulse* const osc) |
| 869 | @brief | 700 | @brief |
| 870 | @param | 701 | @param |
| 871 | */ | 702 | |
| 872 | |||
| 873 | /*! | ||
| 874 | @fn float tMBPulse_tick(tMBPulse* const osc) | 703 | @fn float tMBPulse_tick(tMBPulse* const osc) |
| 875 | @brief | 704 | @brief |
| 876 | @param | 705 | @param |
| 877 | */ | 706 | |
| 878 | |||
| 879 | /*! | ||
| 880 | @fn void tMBPulse_setFreq(tMBPulse* const osc, float f) | 707 | @fn void tMBPulse_setFreq(tMBPulse* const osc, float f) |
| 881 | @brief | 708 | @brief |
| 882 | @param | 709 | @param |
| 883 | */ | 710 | |
| 884 | |||
| 885 | /*! | ||
| 886 | @fn void tMBPulse_setWidth(tMBPulse* const osc, float w) | 711 | @fn void tMBPulse_setWidth(tMBPulse* const osc, float w) |
| 887 | @brief | 712 | @brief |
| 888 | @param | 713 | @param |
| 889 | */ | 714 | |
| 890 | |||
| 891 | /*! | ||
| 892 | @fn void tMBPulse_syncIn(tMBPulse* const osc, float sync) | 715 | @fn void tMBPulse_syncIn(tMBPulse* const osc, float sync) |
| 893 | @brief | 716 | @brief |
| 894 | @param | 717 | @param |
| 895 | */ | 718 | |
| 896 | |||
| 897 | /*! | ||
| 898 | @fn float tMBPulse_syncOut(tMBPulse* const osc) | 719 | @fn float tMBPulse_syncOut(tMBPulse* const osc) |
| 899 | @brief | 720 | @brief |
| 900 | @param | 721 | @param |
| 901 | */ | 722 |  |
| 902 | 723 | @} */ | |
| 903 | /*! @} */ | ||
| 904 | 724 | ||
| 905 | typedef struct _tMBPulse | 725 | typedef struct _tMBPulse |
| 906 | { | 726 | { |
| @@ -935,57 +755,40 @@ extern "C" { · 28 unmodified lines | |||
| 935 | @ingroup oscillators | 755 | @ingroup oscillators |
| 936 | @brief | 756 | @brief |
| 937 | @{ | 757 | @{ |
| 938 | */ | 758 | |
| 939 | |||
| 940 | /*! | ||
| 941 | @fn void tMBTriangle_init(tMBTriangle* const osc) | 759 | @fn void tMBTriangle_init(tMBTriangle* const osc) |
| 942 | @brief | 760 | @brief |
| 943 | @param | 761 | @param |
| 944 | */ | 762 | |
| 945 | |||
| 946 | /*! | ||
| 947 | @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool) | 763 | @fn void tMBTriangle_initToPool(tMBTriangle* const osc, tMempool* const pool) |
| 948 | @brief | 764 | @brief |
| 949 | @param | 765 | @param |
| 950 | */ | 766 | |
| 951 | |||
| 952 | /*! | ||
| 953 | @fn void tMBTriangle_free(tMBTriangle* const osc) | 767 | @fn void tMBTriangle_free(tMBTriangle* const osc) |
| 954 | @brief | 768 | @brief |
| 955 | @param | 769 | @param |
| 956 | */ | 770 | |
| 957 | |||
| 958 | /*! | ||
| 959 | @fn float tMBTriangle_tick(tMBTriangle* const osc) | 771 | @fn float tMBTriangle_tick(tMBTriangle* const osc) |
| 960 | @brief | 772 | @brief |
| 961 | @param | 773 | @param |
| 962 | */ | 774 | |
| 963 | |||
| 964 | /*! | ||
| 965 | @fn void tMBTriangle_setFreq(tMBTriangle* const osc, float f) | 775 | @fn void tMBTriangle_setFreq(tMBTriangle* const osc, float f) |
| 966 | @brief | 776 | @brief |
| 967 | @param | 777 | @param |
| 968 | */ | 778 | |
| 969 | |||
| 970 | /*! | ||
| 971 | @fn void tMBTriangle_setWidth(tMBTriangle* const osc, float w) | 779 | @fn void tMBTriangle_setWidth(tMBTriangle* const osc, float w) |
| 972 | @brief | 780 | @brief |
| 973 | @param | 781 | @param |
| 974 | */ | 782 | |
| 975 | |||
| 976 | /*! | ||
| 977 | @fn void tMBTriangle_syncIn(tMBTriangle* const osc, float sync) | 783 | @fn void tMBTriangle_syncIn(tMBTriangle* const osc, float sync) |
| 978 | @brief | 784 | @brief |
| 979 | @param | 785 | @param |
| 980 | */ | 786 | |
| 981 | |||
| 982 | /*! | ||
| 983 | @fn float tMBTriangle_syncOut(tMBTriangle* const osc) | 787 | @fn float tMBTriangle_syncOut(tMBTriangle* const osc) |
| 984 | @brief | 788 | @brief |
| 985 | @param | 789 | @param |
| 986 | */ | 790 |  |
| 987 | 791 | @} */ | |
| 988 | /*! @} */ | ||
| 989 | 792 | ||
| 990 | typedef struct _tMBTriangle | 793 | typedef struct _tMBTriangle |
| 991 | { | 794 | { |
| @@ -1021,51 +824,36 @@ extern "C" { · 29 unmodified lines | |||
| 1021 | @ingroup oscillators | 824 | @ingroup oscillators |
| 1022 | @brief | 825 | @brief |
| 1023 | @{ | 826 | @{ |
| 1024 | */ | 827 | |
| 1025 | |||
| 1026 | /*! | ||
| 1027 | @fn void tMBSaw_init(tMBSaw* const osc) | 828 | @fn void tMBSaw_init(tMBSaw* const osc) |
| 1028 | @brief | 829 | @brief |
| 1029 | @param | 830 | @param |
| 1030 | */ | 831 | |
| 1031 | |||
| 1032 | /*! | ||
| 1033 | @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool) | 832 | @fn void tMBSaw_initToPool(tMBSaw* const osc, tMempool* const pool) |
| 1034 | @brief | 833 | @brief |
| 1035 | @param | 834 | @param |
| 1036 | */ | 835 | |
| 1037 | |||
| 1038 | /*! | ||
| 1039 | @fn void tMBSaw_free(tMBSaw* const osc) | 836 | @fn void tMBSaw_free(tMBSaw* const osc) |
| 1040 | @brief | 837 | @brief |
| 1041 | @param | 838 | @param |
| 1042 | */ | 839 | |
| 1043 | |||
| 1044 | /*! | ||
| 1045 | @fn float tMBSaw_tick(tMBSaw* const osc) | 840 | @fn float tMBSaw_tick(tMBSaw* const osc) |
| 1046 | @brief | 841 | @brief |
| 1047 | @param | 842 | @param |
| 1048 | */ | 843 | |
| 1049 | |||
| 1050 | /*! | ||
| 1051 | @fn void tMBSaw_setFreq(tMBSaw* const osc, float f) | 844 | @fn void tMBSaw_setFreq(tMBSaw* const osc, float f) |
| 1052 | @brief | 845 | @brief |
| 1053 | @param | 846 | @param |
| 1054 | */ | 847 | |
| 1055 | |||
| 1056 | /*! | ||
| 1057 | @fn void tMBSaw_syncIn(tMBSaw* const osc, float sync) | 848 | @fn void tMBSaw_syncIn(tMBSaw* const osc, float sync) |
| 1058 | @brief | 849 | @brief |
| 1059 | @param | 850 | @param |
| 1060 | */ | 851 | |
| 1061 | |||
| 1062 | /*! | ||
| 1063 | @fn float tMBSaw_syncOut(tMBSaw* const osc) | 852 | @fn float tMBSaw_syncOut(tMBSaw* const osc) |
| 1064 | @brief | 853 | @brief |
| 1065 | @param | 854 | @param |
| 1066 | */ | 855 |  |
| 1067 | 856 | @} */ | |
| 1068 | /*! @} */ | ||
| 1069 | 857 | ||
| 1070 | typedef struct _tMBSaw | 858 | typedef struct _tMBSaw |
| 1071 | { | 859 | { |
| @@ -36,7 +36,54 @@ extern "C" { · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | //============================================================================== | 37 | //============================================================================== |
| 38 | 38 | ||
| 39 | /* Karplus Strong model */ | 39 | /*! |
| 40 | @defgroup tpluck tPluck | ||
| 41 | @ingroup physical | ||
| 42 | @brief Karplus-Strong model | ||
| 43 | @{ | ||
| 44 | |||
| 45 | @fn void tPluck_init (tPluck* const, float lowestFrequency) | ||
| 46 | @brief | ||
| 47 | @param | ||
| 48 | |||
| 49 | @fn void tPluck_initToPool (tPluck* const, float lowestFrequency, tMempool* const) | ||
| 50 | @brief | ||
| 51 | @param | ||
| 52 | |||
| 53 | @fn void tPluck_free (tPluck* const) | ||
| 54 | @brief | ||
| 55 | @param | ||
| 56 | |||
| 57 | @fn float tPluck_tick (tPluck* const) | ||
| 58 | @brief | ||
| 59 | @param | ||
| 60 | |||
| 61 | @fn void tPluck_pluck (tPluck* const, float amplitude) | ||
| 62 | @brief Pluck the string. | ||
| 63 | @param | ||
| 64 | |||
| 65 | @fn void tPluck_noteOn (tPluck* const, float frequency, float amplitude ) | ||
| 66 | @brief Start a note with the given frequency and amplitude. | ||
| 67 | @param | ||
| 68 | |||
| 69 | @fn void tPluck_noteOff (tPluck* const, float amplitude ) | ||
| 70 | @brief Stop a note with the given amplitude (speed of decay) | ||
| 71 | @param | ||
| 72 | |||
| 73 | @fn void tPluck_setFrequency (tPluck* const, float frequency ) | ||
| 74 | @brief Set instrument parameters for a particular frequency. | ||
| 75 | @param | ||
| 76 | |||
| 77 | @fn void tPluck_controlChange (tPluck* const, int number, float value) | ||
| 78 | @brief Perform the control change specified by \e number and \e value (0.0 - 128.0). | ||
| 79 | @param | ||
| 80 | |||
| 81 | @fn float tPluck_getLastOut (tPluck* const) | ||
| 82 | @brief | ||
| 83 | @param | ||
| 84 | |||
| 85 | @} */ | ||
| 86 | |||
| 40 | typedef struct _tPluck | 87 | typedef struct _tPluck |
| 41 | { | 88 | { |
| 42 | tMempool mempool; | 89 | tMempool mempool; |
| @@ -59,28 +106,76 @@ extern "C" { · 16 unmodified lines | |||
| 59 | void tPluck_initToPool (tPluck* const, float lowestFrequency, tMempool* const); | 106 | void tPluck_initToPool (tPluck* const, float lowestFrequency, tMempool* const); |
| 60 | void tPluck_free (tPluck* const); | 107 | void tPluck_free (tPluck* const); |
| 61 | 108 | ||
| 62 | float tPluck_tick (tPluck* const); | 109 | float tPluck_tick (tPluck* const); |
| 63 | |||
| 64 | // Pluck the string. | ||
| 65 | void tPluck_pluck (tPluck* const, float amplitude); | 110 | void tPluck_pluck (tPluck* const, float amplitude); |
| 66 | |||
| 67 | // Start a note with the given frequency and amplitude.; | ||
| 68 | void tPluck_noteOn (tPluck* const, float frequency, float amplitude ); | 111 | void tPluck_noteOn (tPluck* const, float frequency, float amplitude ); |
| 69 | |||
| 70 | // Stop a note with the given amplitude (speed of decay). | ||
| 71 | void tPluck_noteOff (tPluck* const, float amplitude ); | 112 | void tPluck_noteOff (tPluck* const, float amplitude ); |
| 72 | |||
| 73 | // Set instrument parameters for a particular frequency. | ||
| 74 | void tPluck_setFrequency (tPluck* const, float frequency ); | 113 | void tPluck_setFrequency (tPluck* const, float frequency ); |
| 75 | |||
| 76 | // Perform the control change specified by \e number and \e value (0.0 - 128.0). | ||
| 77 | void tPluck_controlChange (tPluck* const, int number, float value); | 114 | void tPluck_controlChange (tPluck* const, int number, float value); |
| 78 | |||
| 79 | // tPluck Utilities. | ||
| 80 | float tPluck_getLastOut (tPluck* const); | 115 | float tPluck_getLastOut (tPluck* const); |
| 81 | 116 | ||
| 82 | //============================================================================== | 117 | //============================================================================== |
| 83 | 118 | ||
| 119 | /*! | ||
| 120 | @defgroup tkarplusstrong tKarplusStrong | ||
| 121 | @ingroup physical | ||
| 122 | @brief Stiff Karplus-Strong model | ||
| 123 | @{ | ||
| 124 | |||
| 125 | @fn void tKarplusStrong_init (tKarplusStrong* const, float lowestFrequency) | ||
| 126 | @brief | ||
| 127 | @param | ||
| 128 | |||
| 129 | @fn void tKarplusStrong_initToPool (tKarplusStrong* const, float lowestFrequency, tMempool* const) | ||
| 130 | @brief | ||
| 131 | @param | ||
| 132 | |||
| 133 | @fn void tKarplusStrong_free (tKarplusStrong* const) | ||
| 134 | @brief | ||
| 135 | @param | ||
| 136 | |||
| 137 | @fn float tKarplusStrong_tick (tKarplusStrong* const) | ||
| 138 | @brief | ||
| 139 | @param | ||
| 140 | |||
| 141 | @fn void tKarplusStrong_pluck (tKarplusStrong* const, float amplitude) | ||
| 142 | @brief Pluck the string. | ||
| 143 | @param | ||
| 144 | |||
| 145 | @fn void tKarplusStrong_noteOn (tKarplusStrong* const, float frequency, float amplitude) | ||
| 146 | @brief Start a note with the given frequency and amplitude. | ||
| 147 | @param | ||
| 148 | |||
| 149 | @fn void tKarplusStrong_noteOff (tKarplusStrong* const, float amplitude) | ||
| 150 | @brief Stop a note with the given amplitude (speed of decay). | ||
| 151 | @param | ||
| 152 | |||
| 153 | @fn void tKarplusStrong_setFrequency (tKarplusStrong* const, float frequency) | ||
| 154 | @brief Set instrument parameters for a particular frequency. | ||
| 155 | @param | ||
| 156 | |||
| 157 | @fn void tKarplusStrong_controlChange (tKarplusStrong* const, SKControlType type, float value) | ||
| 158 | @brief Perform the control change specified by \e number and \e value (0.0 - 128.0). Use SKPickPosition, SKStringDamping, or SKDetune for type. | ||
| 159 | @param | ||
| 160 | |||
| 161 | @fn void tKarplusStrong_setStretch (tKarplusStrong* const, float stretch) | ||
| 162 | @brief Set the stretch "factor" of the string (0.0 - 1.0). | ||
| 163 | @param | ||
| 164 | |||
| 165 | @fn void tKarplusStrong_setPickupPosition (tKarplusStrong* const, float position) | ||
| 166 | @brief Set the pluck or "excitation" position along the string (0.0 - 1.0). | ||
| 167 | @param | ||
| 168 | |||
| 169 | @fn void tKarplusStrong_setBaseLoopGain (tKarplusStrong* const, float aGain ) | ||
| 170 | @brief Set the base loop gain. | ||
| 171 | @param | ||
| 172 | |||
| 173 | @fn float tKarplusStrong_getLastOut (tKarplusStrong* const) | ||
| 174 | @brief | ||
| 175 | @param | ||
| 176 | |||
| 177 | @} */ | ||
| 178 | |||
| 84 | typedef enum SKControlType | 179 | typedef enum SKControlType |
| 85 | { | 180 | { |
| 86 | SKPickPosition = 0, | 181 | SKPickPosition = 0, |
| @@ -89,7 +184,6 @@ extern "C" { · 2 unmodified lines | |||
| 89 | SKControlTypeNil | 184 | SKControlTypeNil |
| 90 | } SKControlType; | 185 | } SKControlType; |
| 91 | 186 | ||
| 92 | /* Stif Karplus Strong model */ | ||
| 93 | typedef struct _tKarplusStrong | 187 | typedef struct _tKarplusStrong |
| 94 | { | 188 | { |
| 95 | tMempool mempool; | 189 | tMempool mempool; |
| @@ -119,38 +213,78 @@ extern "C" { · 23 unmodified lines | |||
| 119 | void tKarplusStrong_free (tKarplusStrong* const); | 213 | void tKarplusStrong_free (tKarplusStrong* const); |
| 120 | 214 | ||
| 121 | float tKarplusStrong_tick (tKarplusStrong* const); | 215 | float tKarplusStrong_tick (tKarplusStrong* const); |
| 122 | |||
| 123 | // Pluck the string. | ||
| 124 | void tKarplusStrong_pluck (tKarplusStrong* const, float amplitude); | 216 | void tKarplusStrong_pluck (tKarplusStrong* const, float amplitude); |
| 125 | |||
| 126 | // Start a note with the given frequency and amplitude.; | ||
| 127 | void tKarplusStrong_noteOn (tKarplusStrong* const, float frequency, float amplitude ); | 217 | void tKarplusStrong_noteOn (tKarplusStrong* const, float frequency, float amplitude ); |
| 128 | |||
| 129 | // Stop a note with the given amplitude (speed of decay). | ||
| 130 | void tKarplusStrong_noteOff (tKarplusStrong* const, float amplitude ); | 218 | void tKarplusStrong_noteOff (tKarplusStrong* const, float amplitude ); |
| 131 | |||
| 132 | // Set instrument parameters for a particular frequency. | ||
| 133 | void tKarplusStrong_setFrequency (tKarplusStrong* const, float frequency ); | 219 | void tKarplusStrong_setFrequency (tKarplusStrong* const, float frequency ); |
| 134 | |||
| 135 | // Perform the control change specified by \e number and \e value (0.0 - 128.0). | ||
| 136 | // Use SKPickPosition, SKStringDamping, or SKDetune for type. | ||
| 137 | void tKarplusStrong_controlChange (tKarplusStrong* const, SKControlType type, float value); | 220 | void tKarplusStrong_controlChange (tKarplusStrong* const, SKControlType type, float value); |
| 138 | |||
| 139 | // Set the stretch "factor" of the string (0.0 - 1.0). | ||
| 140 | void tKarplusStrong_setStretch (tKarplusStrong* const, float stretch ); | 221 | void tKarplusStrong_setStretch (tKarplusStrong* const, float stretch ); |
| 141 | |||
| 142 | // Set the pluck or "excitation" position along the string (0.0 - 1.0). | ||
| 143 | void tKarplusStrong_setPickupPosition (tKarplusStrong* const, float position ); | 222 | void tKarplusStrong_setPickupPosition (tKarplusStrong* const, float position ); |
| 144 | |||
| 145 | // Set the base loop gain. | ||
| 146 | void tKarplusStrong_setBaseLoopGain (tKarplusStrong* const, float aGain ); | 223 | void tKarplusStrong_setBaseLoopGain (tKarplusStrong* const, float aGain ); |
| 147 | |||
| 148 | // tKarplusStrong utilities. | ||
| 149 | float tKarplusStrong_getLastOut (tKarplusStrong* const); | 224 | float tKarplusStrong_getLastOut (tKarplusStrong* const); |
| 150 | 225 | ||
| 151 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 226 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 152 | 227 | ||
| 153 | /* Simple Living String */ | 228 | /*! |
| 229 | @defgroup tsimplelivingstring tSimpleLivingString | ||
| 230 | @ingroup physical | ||
| 231 | @brief | ||
| 232 | @{ | ||
| 233 | |||
| 234 | @fn void tSimpleLivingString_init (tSimpleLivingString* const, float freq, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode) | ||
| 235 | @brief | ||
| 236 | @param | ||
| 237 | |||
| 238 | @fn void tSimpleLivingString_initToPool (tSimpleLivingString* const, float freq, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode, tMempool* const) | ||
| 239 | @brief | ||
| 240 | @param | ||
| 241 | |||
| 242 | @fn void tSimpleLivingString_free (tSimpleLivingString* const) | ||
| 243 | @brief | ||
| 244 | @param | ||
| 245 | |||
| 246 | @fn float tSimpleLivingString_tick (tSimpleLivingString* const, float input) | ||
| 247 | @brief | ||
| 248 | @param | ||
| 249 | |||
| 250 | @fn float tSimpleLivingString_sample (tSimpleLivingString* const) | ||
| 251 | @brief | ||
| 252 | @param | ||
| 253 | |||
| 254 | @fn void tSimpleLivingString_setFreq (tSimpleLivingString* const, float freq) | ||
| 255 | @brief | ||
| 256 | @param | ||
| 257 | |||
| 258 | @fn void tSimpleLivingString_setWaveLength (tSimpleLivingString* const, float waveLength) | ||
| 259 | @brief | ||
| 260 | @param | ||
| 261 | |||
| 262 | @fn void tSimpleLivingString_setDampFreq (tSimpleLivingString* const, float dampFreq) | ||
| 263 | @brief | ||
| 264 | @param | ||
| 265 | |||
| 266 | @fn void tSimpleLivingString_setDecay (tSimpleLivingString* const, float decay) | ||
| 267 | @brief | ||
| 268 | @param | ||
| 269 | |||
| 270 | @fn void tSimpleLivingString_setTargetLev (tSimpleLivingString* const, float targetLev) | ||
| 271 | @brief | ||
| 272 | @param | ||
| 273 | |||
| 274 | @fn void tSimpleLivingString_setLevSmoothFactor (tSimpleLivingString* const, float levSmoothFactor) | ||
| 275 | @brief | ||
| 276 | @param | ||
| 277 | |||
| 278 | @fn void tSimpleLivingString_setLevStrength (tSimpleLivingString* const, float levStrength) | ||
| 279 | @brief | ||
| 280 | @param | ||
| 281 | |||
| 282 | @fn void tSimpleLivingString_setLevMode (tSimpleLivingString* const, int levMode) | ||
| 283 | @brief | ||
| 284 | @param | ||
| 285 | |||
| 286 | @} */ | ||
| 287 | |||
| 154 | typedef struct _tSimpleLivingString | 288 | typedef struct _tSimpleLivingString |
| 155 | { | 289 | { |
| 156 | tMempool mempool; | 290 | tMempool mempool; |
| @@ -189,7 +323,74 @@ extern "C" { · 32 unmodified lines | |||
| 189 | 323 | ||
| 190 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 324 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 191 | 325 | ||
| 192 | /* Living String */ | 326 | /*! |
| 327 | @defgroup tlivingstring tLivingString | ||
| 328 | @ingroup physical | ||
| 329 | @brief | ||
| 330 | @{ | ||
| 331 | |||
| 332 | @fn void tLivingString_init (tLivingString* const, float freq, float pickPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode) | ||
| 333 | @brief | ||
| 334 | @param | ||
| 335 | |||
| 336 | @fn void tLivingString_initToPool (tLivingString* const, float freq, float pickPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode, tMempool* const) | ||
| 337 | @brief | ||
| 338 | @param | ||
| 339 | |||
| 340 | @fn void tLivingString_free (tLivingString* const) | ||
| 341 | @brief | ||
| 342 | @param | ||
| 343 | |||
| 344 | @fn float tLivingString_tick (tLivingString* const, float input) | ||
| 345 | @brief | ||
| 346 | @param | ||
| 347 | |||
| 348 | @fn float tLivingString_sample (tLivingString* const) | ||
| 349 | @brief | ||
| 350 | @param | ||
| 351 | |||
| 352 | @fn void tLivingString_setFreq (tLivingString* const, float freq) | ||
| 353 | @brief | ||
| 354 | @param | ||
| 355 | |||
| 356 | @fn void tLivingString_setWaveLength (tLivingString* const, float waveLength) | ||
| 357 | @brief | ||
| 358 | @param | ||
| 359 | |||
| 360 | @fn void tLivingString_setPickPos (tLivingString* const, float pickPos) | ||
| 361 | @brief | ||
| 362 | @param | ||
| 363 | |||
| 364 | @fn void tLivingString_setPrepIndex (tLivingString* const, float prepIndex) | ||
| 365 | @brief | ||
| 366 | @param | ||
| 367 | |||
| 368 | @fn void tLivingString_setDampFreq (tLivingString* const, float dampFreq) | ||
| 369 | @brief | ||
| 370 | @param | ||
| 371 | |||
| 372 | @fn void tLivingString_setDecay (tLivingString* const, float decay) | ||
| 373 | @brief | ||
| 374 | @param | ||
| 375 | |||
| 376 | @fn void tLivingString_setTargetLev (tLivingString* const, float targetLev) | ||
| 377 | @brief | ||
| 378 | @param | ||
| 379 | |||
| 380 | @fn void tLivingString_setLevSmoothFactor (tLivingString* const, float levSmoothFactor) | ||
| 381 | @brief | ||
| 382 | @param | ||
| 383 | |||
| 384 | @fn void tLivingString_setLevStrength (tLivingString* const, float levStrength) | ||
| 385 | @brief | ||
| 386 | @param | ||
| 387 | |||
| 388 | @fn void tLivingString_setLevMode (tLivingString* const, int levMode) | ||
| 389 | @brief | ||
| 390 | @param | ||
| 391 | |||
| 392 | @} */ | ||
| 393 | |||
| 193 | typedef struct _tLivingString | 394 | typedef struct _tLivingString |
| 194 | { | 395 | { |
| 195 | tMempool mempool; | 396 | tMempool mempool; |
| @@ -234,7 +435,78 @@ extern "C" { · 38 unmodified lines | |||
| 234 | 435 | ||
| 235 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 436 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 236 | 437 | ||
| 237 | /* Complex Living String */ | 438 | /*! |
| 439 | @defgroup tcomplexlivingstring tComplexLivingString | ||
| 440 | @ingroup physical | ||
| 441 | @brief | ||
| 442 | @{ | ||
| 443 | |||
| 444 | @fn void tComplexLivingString_init (tComplexLivingString* const, float freq, float pickPos, float prepPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode) | ||
| 445 | @brief | ||
| 446 | @param | ||
| 447 | |||
| 448 | @fn void tComplexLivingString_initToPool (tComplexLivingString* const, float freq, float pickPos, float prepPos, float prepIndex, float dampFreq, float decay, float targetLev, float levSmoothFactor, float levStrength, int levMode, tMempool* const) | ||
| 449 | @brief | ||
| 450 | @param | ||
| 451 | |||
| 452 | @fn void tComplexLivingString_free (tComplexLivingString* const) | ||
| 453 | @brief | ||
| 454 | @param | ||
| 455 | |||
| 456 | @fn float tComplexLivingString_tick (tComplexLivingString* const, float input) | ||
| 457 | @brief | ||
| 458 | @param | ||
| 459 | |||
| 460 | @fn float tComplexLivingString_sample (tComplexLivingString* const) | ||
| 461 | @brief | ||
| 462 | @param | ||
| 463 | |||
| 464 | @fn void tComplexLivingString_setFreq (tComplexLivingString* const, float freq) | ||
| 465 | @brief | ||
| 466 | @param | ||
| 467 | |||
| 468 | @fn void tComplexLivingString_setWaveLength (tComplexLivingString* const, float waveLength) | ||
| 469 | @brief | ||
| 470 | @param | ||
| 471 | |||
| 472 | @fn void tComplexLivingString_setPickPos (tComplexLivingString* const, float pickPos) | ||
| 473 | @brief | ||
| 474 | @param | ||
| 475 | |||
| 476 | @fn void tComplexLivingString_setPrepPos (tComplexLivingString* const, float prepPos) | ||
| 477 | @brief | ||
| 478 | @param | ||
| 479 | |||
| 480 | @fn void tComplexLivingString_setPrepIndex (tComplexLivingString* const, float prepIndex) | ||
| 481 | @brief | ||
| 482 | @param | ||
| 483 | |||
| 484 | @fn void tComplexLivingString_setDampFreq (tComplexLivingString* const, float dampFreq) | ||
| 485 | @brief | ||
| 486 | @param | ||
| 487 | |||
| 488 | @fn void tComplexLivingString_setDecay (tComplexLivingString* const, float decay) | ||
| 489 | @brief | ||
| 490 | @param | ||
| 491 | |||
| 492 | @fn void tComplexLivingString_setTargetLev (tComplexLivingString* const, float targetLev) | ||
| 493 | @brief | ||
| 494 | @param | ||
| 495 | |||
| 496 | @fn void tComplexLivingString_setLevSmoothFactor (tComplexLivingString* const, float levSmoothFactor) | ||
| 497 | @brief | ||
| 498 | @param | ||
| 499 | |||
| 500 | @fn void tComplexLivingString_setLevStrength (tComplexLivingString* const, float levStrength) | ||
| 501 | @brief | ||
| 502 | @param | ||
| 503 | |||
| 504 | @fn void tComplexLivingString_setLevMode (tComplexLivingString* const, int levMode) | ||
| 505 | @brief | ||
| 506 | @param | ||
| 507 | |||
| 508 | @} */ | ||
| 509 | |||
| 238 | typedef struct _tComplexLivingString | 510 | typedef struct _tComplexLivingString |
| 239 | { | 511 | { |
| 240 | tMempool mempool; | 512 | tMempool mempool; |
| @@ -277,11 +549,46 @@ extern "C" { · 36 unmodified lines | |||
| 277 | void tComplexLivingString_setLevSmoothFactor (tComplexLivingString* const, float levSmoothFactor); | 549 | void tComplexLivingString_setLevSmoothFactor (tComplexLivingString* const, float levSmoothFactor); |
| 278 | void tComplexLivingString_setLevStrength (tComplexLivingString* const, float levStrength); | 550 | void tComplexLivingString_setLevStrength (tComplexLivingString* const, float levStrength); |
| 279 | void tComplexLivingString_setLevMode (tComplexLivingString* const, int levMode); | 551 | void tComplexLivingString_setLevMode (tComplexLivingString* const, int levMode); |
| 552 | |||
| 280 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ | 553 | // ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ |
| 281 | 554 | ||
| 282 | 555 | ||
| 283 | 556 | /*! | |
| 284 | //Reed Table - borrowed from STK | 557 | @defgroup treedtable tReedTable |
| 558 | @ingroup physical | ||
| 559 | @brief Reed Table - borrowed from STK | ||
| 560 | @{ | ||
| 561 | |||
| 562 | @fn void tReedTable_init (tReedTable* const, float offset, float slope) | ||
| 563 | @brief | ||
| 564 | @param | ||
| 565 | |||
| 566 | @fn void tReedTable_initToPool (tReedTable* const, float offset, float slope, tMempool* const) | ||
| 567 | @brief | ||
| 568 | @param | ||
| 569 | |||
| 570 | @fn void tReedTable_free (tReedTable* const) | ||
| 571 | @brief | ||
| 572 | @param | ||
| 573 | |||
| 574 | @fn float tReedTable_tick (tReedTable* const, float input) | ||
| 575 | @brief | ||
| 576 | @param | ||
| 577 | |||
| 578 | @fn float tReedTable_tanh_tick (tReedTable* const, float input) | ||
| 579 | @brief | ||
| 580 | @param | ||
| 581 | |||
| 582 | @fn void tReedTable_setOffset (tReedTable* const, float offset) | ||
| 583 | @brief | ||
| 584 | @param | ||
| 585 | |||
| 586 | @fn void tReedTable_setSlope (tReedTable* const, float slope) | ||
| 587 | @brief | ||
| 588 | @param | ||
| 589 | |||
| 590 | @} */ | ||
| 591 | |||
| 285 | typedef struct _tReedTable | 592 | typedef struct _tReedTable |
| 286 | { | 593 | { |
| 287 | tMempool mempool; | 594 | tMempool mempool; |
| @@ -32,7 +32,42 @@ extern "C" { · 31 unmodified lines | |||
| 32 | 32 | ||
| 33 | //============================================================================== | 33 | //============================================================================== |
| 34 | 34 | ||
| 35 | /* PRCReverb: Reverb, reimplemented from STK (Cook and Scavone). */ | 35 | /*! |
| 36 | @defgroup tprcreverb tPRCReverb | ||
| 37 | @ingroup reverb | ||
| 38 | @brief Reverb, reimplemented from STK (Cook and Scavone). | ||
| 39 | @{ | ||
| 40 | |||
| 41 | @fn void tPRCReverb_init (tPRCReverb* const, float t60) | ||
| 42 | @brief | ||
| 43 | @param | ||
| 44 | |||
| 45 | @fn void tPRCReverb_initToPool (tPRCReverb* const, float t60, tMempool* const) | ||
| 46 | @brief | ||
| 47 | @param | ||
| 48 | |||
| 49 | @fn void tPRCReverb_free (tPRCReverb* const) | ||
| 50 | @brief | ||
| 51 | @param | ||
| 52 | |||
| 53 | @fn void tPRCReverb_clear (tPRCReverb* const) | ||
| 54 | @brief | ||
| 55 | @param | ||
| 56 | |||
| 57 | @fn float tPRCReverb_tick (tPRCReverb* const, float input) | ||
| 58 | @brief | ||
| 59 | @param | ||
| 60 | |||
| 61 | @fn void tPRCReverb_setT60 (tPRCReverb* const, float t60) | ||
| 62 | @brief Set reverb time in seconds. | ||
| 63 | @param | ||
| 64 | |||
| 65 | @fn void tPRCReverb_setMix (tPRCReverb* const, float mix) | ||
| 66 | @brief Set mix between dry input and wet output signal. | ||
| 67 | @param | ||
| 68 | |||
| 69 | @} */ | ||
| 70 | |||
| 36 | typedef struct _tPRCReverb | 71 | typedef struct _tPRCReverb |
| 37 | { | 72 | { |
| 38 | tMempool mempool; | 73 | tMempool mempool; |
| @@ -57,16 +92,51 @@ extern "C" { · 18 unmodified lines | |||
| 57 | 92 | ||
| 58 | void tPRCReverb_clear (tPRCReverb* const); | 93 | void tPRCReverb_clear (tPRCReverb* const); |
| 59 | float tPRCReverb_tick (tPRCReverb* const, float input); | 94 | float tPRCReverb_tick (tPRCReverb* const, float input); |
| 60 | |||
| 61 | // Set reverb time in seconds. | ||
| 62 | void tPRCReverb_setT60 (tPRCReverb* const, float t60); | 95 | void tPRCReverb_setT60 (tPRCReverb* const, float t60); |
| 63 | |||
| 64 | // Set mix between dry input and wet output signal. | ||
| 65 | void tPRCReverb_setMix (tPRCReverb* const, float mix); | 96 | void tPRCReverb_setMix (tPRCReverb* const, float mix); |
| 66 | 97 | ||
| 67 | //============================================================================== | 98 | //============================================================================== |
| 68 | 99 | ||
| 69 | /* NReverb: Reverb, reimplemented from STK (Cook and Scavone). */ | 100 | /*! |
| 101 | @defgroup tnreverb tNReverb | ||
| 102 | @ingroup reverb | ||
| 103 | @brief Reverb, reimplemented from STK (Cook and Scavone). | ||
| 104 | @{ | ||
| 105 | |||
| 106 | @fn void tNReverb_init (tNReverb* const, float t60) | ||
| 107 | @brief | ||
| 108 | @param | ||
| 109 | |||
| 110 | @fn void tNReverb_initToPool (tNReverb* const, float t60, tMempool* const) | ||
| 111 | @brief | ||
| 112 | @param | ||
| 113 | |||
| 114 | @fn void tNReverb_free (tNReverb* const) | ||
| 115 | @brief | ||
| 116 | @param | ||
| 117 | |||
| 118 | @fn void tNReverb_clear (tNReverb* const) | ||
| 119 | @brief | ||
| 120 | @param | ||
| 121 | |||
| 122 | @fn float tNReverb_tick (tNReverb* const, float input) | ||
| 123 | @brief | ||
| 124 | @param | ||
| 125 | |||
| 126 | @fn void tNReverb_tickStereo (tNReverb* const rev, float input, float* output) | ||
| 127 | @brief | ||
| 128 | @param | ||
| 129 | |||
| 130 | @fn void tNReverb_setT60 (tNReverb* const, float t60) | ||
| 131 | @brief Set reverb time in seconds. | ||
| 132 | @param | ||
| 133 | |||
| 134 | @fn void tNReverb_setMix (tNReverb* const, float mix) | ||
| 135 | @brief Set mix between dry input and wet output signal. | ||
| 136 | @param | ||
| 137 | |||
| 138 | @} */ | ||
| 139 | |||
| 70 | typedef struct _tNReverb | 140 | typedef struct _tNReverb |
| 71 | { | 141 | { |
| 72 | tMempool mempool; | 142 | tMempool mempool; |
| @@ -93,15 +163,75 @@ extern "C" { · 20 unmodified lines | |||
| 93 | void tNReverb_clear (tNReverb* const); | 163 | void tNReverb_clear (tNReverb* const); |
| 94 | float tNReverb_tick (tNReverb* const, float input); | 164 | float tNReverb_tick (tNReverb* const, float input); |
| 95 | void tNReverb_tickStereo (tNReverb* const rev, float input, float* output); | 165 | void tNReverb_tickStereo (tNReverb* const rev, float input, float* output); |
| 96 | |||
| 97 | // Set reverb time in seconds. | ||
| 98 | void tNReverb_setT60 (tNReverb* const, float t60); | 166 | void tNReverb_setT60 (tNReverb* const, float t60); |
| 99 | |||
| 100 | // Set mix between dry input and wet output signal. | ||
| 101 | void tNReverb_setMix (tNReverb* const, float mix); | 167 | void tNReverb_setMix (tNReverb* const, float mix); |
| 102 | 168 | ||
| 103 | //============================================================================== | 169 | //============================================================================== |
| 104 | 170 | ||
| 171 | /*! | ||
| 172 | @defgroup tdattorroreverb tDattorroReverb | ||
| 173 | @ingroup reverb | ||
| 174 | @brief | ||
| 175 | @{ | ||
| 176 | |||
| 177 | @fn void tDattorroReverb_init (tDattorroReverb* const) | ||
| 178 | @brief | ||
| 179 | @param | ||
| 180 | |||
| 181 | @fn void tDattorroReverb_initToPool (tDattorroReverb* const, tMempool* const) | ||
| 182 | @brief | ||
| 183 | @param | ||
| 184 | |||
| 185 | @fn void tDattorroReverb_free (tDattorroReverb* const) | ||
| 186 | @brief | ||
| 187 | @param | ||
| 188 | |||
| 189 | @fn void tDattorroReverb_clear (tDattorroReverb* const) | ||
| 190 | @brief | ||
| 191 | @param | ||
| 192 | |||
| 193 | @fn float tDattorroReverb_tick (tDattorroReverb* const, float input) | ||
| 194 | @brief | ||
| 195 | @param | ||
| 196 | |||
| 197 | @fn void tDattorroReverb_tickStereo (tDattorroReverb* const rev, float input, float* output) | ||
| 198 | @brief | ||
| 199 | @param | ||
| 200 | |||
| 201 | @fn void tDattorroReverb_setMix (tDattorroReverb* const, float mix) | ||
| 202 | @brief | ||
| 203 | @param | ||
| 204 | |||
| 205 | @fn void tDattorroReverb_setFreeze (tDattorroReverb* const rev, uint32_t freeze) | ||
| 206 | @brief | ||
| 207 | @param | ||
| 208 | |||
| 209 | @fn void tDattorroReverb_setHP (tDattorroReverb* const, float freq) | ||
| 210 | @brief | ||
| 211 | @param | ||
| 212 | |||
| 213 | @fn void tDattorroReverb_setSize (tDattorroReverb* const, float size) | ||
| 214 | @brief | ||
| 215 | @param | ||
| 216 | |||
| 217 | @fn void tDattorroReverb_setInputDelay (tDattorroReverb* const, float preDelay) | ||
| 218 | @brief | ||
| 219 | @param | ||
| 220 | |||
| 221 | @fn void tDattorroReverb_setInputFilter (tDattorroReverb* const, float freq) | ||
| 222 | @brief | ||
| 223 | @param | ||
| 224 | |||
| 225 | @fn void tDattorroReverb_setFeedbackFilter (tDattorroReverb* const, float freq) | ||
| 226 | @brief | ||
| 227 | @param | ||
| 228 | |||
| 229 | @fn void tDattorroReverb_setFeedbackGain (tDattorroReverb* const, float gain) | ||
| 230 | @brief | ||
| 231 | @param | ||
| 232 | |||
| 233 | @} */ | ||
| 234 | |||
| 105 | typedef struct _tDattorroReverb | 235 | typedef struct _tDattorroReverb |
| 106 | { | 236 | { |
| 107 | tMempool mempool; | 237 | tMempool mempool; |
| @@ -33,6 +33,78 @@ extern "C" { · 32 unmodified lines | |||
| 33 | 33 | ||
| 34 | //============================================================================== | 34 | //============================================================================== |
| 35 | 35 | ||
| 36 | /*! | ||
| 37 | @defgroup tbuffer tBuffer | ||
| 38 | @ingroup sampling | ||
| 39 | @brief | ||
| 40 | @{ | ||
| 41 | |||
| 42 | @fn void tBuffer_init (tBuffer* const, uint32_t length) | ||
| 43 | @brief | ||
| 44 | @param | ||
| 45 | |||
| 46 | @fn void tBuffer_initToPool (tBuffer* const, uint32_t length, tMempool* const) | ||
| 47 | @brief | ||
| 48 | @param | ||
| 49 | |||
| 50 | @fn void tBuffer_free (tBuffer* const) | ||
| 51 | @brief | ||
| 52 | @param | ||
| 53 | |||
| 54 | @fn void tBuffer_tick (tBuffer* const, float sample) | ||
| 55 | @brief | ||
| 56 | @param | ||
| 57 | |||
| 58 | @fn void tBuffer_read (tBuffer* const, float* buff, uint32_t len) | ||
| 59 | @brief | ||
| 60 | @param | ||
| 61 | |||
| 62 | @fn float tBuffer_get (tBuffer* const, int idx) | ||
| 63 | @brief | ||
| 64 | @param | ||
| 65 | |||
| 66 | @fn void tBuffer_record (tBuffer* const) | ||
| 67 | @brief | ||
| 68 | @param | ||
| 69 | |||
| 70 | @fn void tBuffer_stop (tBuffer* const) | ||
| 71 | @brief | ||
| 72 | @param | ||
| 73 | |||
| 74 | @fn int tBuffer_getRecordPosition (tBuffer* const) | ||
| 75 | @brief | ||
| 76 | @param | ||
| 77 | |||
| 78 | @fn void tBuffer_setRecordPosition (tBuffer* const, int pos) | ||
| 79 | @brief | ||
| 80 | @param | ||
| 81 | |||
| 82 | @fn void tBuffer_setRecordMode (tBuffer* const, RecordMode mode) | ||
| 83 | @brief | ||
| 84 | @param | ||
| 85 | |||
| 86 | @fn void tBuffer_clear (tBuffer* const) | ||
| 87 | @brief | ||
| 88 | @param | ||
| 89 | |||
| 90 | @fn uint32_t tBuffer_getBufferLength (tBuffer* const) | ||
| 91 | @brief | ||
| 92 | @param | ||
| 93 | |||
| 94 | @fn uint32_t tBuffer_getRecordedLength (tBuffer* const sb) | ||
| 95 | @brief | ||
| 96 | @param | ||
| 97 | |||
| 98 | @fn void tBuffer_setRecordedLength (tBuffer* const sb, int length) | ||
| 99 | @brief | ||
| 100 | @param | ||
| 101 | |||
| 102 | @fn int tBuffer_isActive (tBuffer* const sb) | ||
| 103 | @brief | ||
| 104 | @param | ||
| 105 | |||
| 106 | @} */ | ||
| 107 | |||
| 36 | typedef enum RecordMode | 108 | typedef enum RecordMode |
| 37 | { | 109 | { |
| 38 | RecordOneShot = 0, | 110 | RecordOneShot = 0, |
| @@ -61,20 +133,14 @@ extern "C" { · 22 unmodified lines | |||
| 61 | void tBuffer_free (tBuffer* const); | 133 | void tBuffer_free (tBuffer* const); |
| 62 | 134 | ||
| 63 | void tBuffer_tick (tBuffer* const, float sample); | 135 | void tBuffer_tick (tBuffer* const, float sample); |
| 64 | |||
| 65 | void tBuffer_read (tBuffer* const, float* buff, uint32_t len); | 136 | void tBuffer_read (tBuffer* const, float* buff, uint32_t len); |
| 66 | |||
| 67 | float tBuffer_get (tBuffer* const, int idx); | 137 | float tBuffer_get (tBuffer* const, int idx); |
| 68 | |||
| 69 | void tBuffer_record (tBuffer* const); | 138 | void tBuffer_record (tBuffer* const); |
| 70 | void tBuffer_stop (tBuffer* const); | 139 | void tBuffer_stop (tBuffer* const); |
| 71 | int tBuffer_getRecordPosition (tBuffer* const); | 140 | int tBuffer_getRecordPosition (tBuffer* const); |
| 72 | void tBuffer_setRecordPosition (tBuffer* const, int pos); | 141 | void tBuffer_setRecordPosition (tBuffer* const, int pos); |
| 73 | |||
| 74 | void tBuffer_setRecordMode (tBuffer* const, RecordMode mode); | 142 | void tBuffer_setRecordMode (tBuffer* const, RecordMode mode); |
| 75 | |||
| 76 | void tBuffer_clear (tBuffer* const); | 143 | void tBuffer_clear (tBuffer* const); |
| 77 | |||
| 78 | uint32_t tBuffer_getBufferLength (tBuffer* const); | 144 | uint32_t tBuffer_getBufferLength (tBuffer* const); |
| 79 | uint32_t tBuffer_getRecordedLength (tBuffer* const sb); | 145 | uint32_t tBuffer_getRecordedLength (tBuffer* const sb); |
| 80 | void tBuffer_setRecordedLength (tBuffer* const sb, int length); | 146 | void tBuffer_setRecordedLength (tBuffer* const sb, int length); |
| @@ -82,6 +148,66 @@ extern "C" { · 1 unmodified line | |||
| 82 | 148 | ||
| 83 | //============================================================================== | 149 | //============================================================================== |
| 84 | 150 | ||
| 151 | /*! | ||
| 152 | @defgroup tsampler tSampler | ||
| 153 | @ingroup sampling | ||
| 154 | @brief | ||
| 155 | @{ | ||
| 156 | |||
| 157 | @fn void tSampler_init (tSampler* const, tBuffer* const) | ||
| 158 | @brief | ||
| 159 | @param | ||
| 160 | |||
| 161 | @fn void tSampler_initToPool (tSampler* const, tBuffer* const, tMempool* const) | ||
| 162 | @brief | ||
| 163 | @param | ||
| 164 | |||
| 165 | @fn void tSampler_free (tSampler* const) | ||
| 166 | @brief | ||
| 167 | @param | ||
| 168 | |||
| 169 | @fn float tSampler_tick (tSampler* const) | ||
| 170 | @brief | ||
| 171 | @param | ||
| 172 | |||
| 173 | @fn void tSampler_setSample (tSampler* const, tBuffer* const) | ||
| 174 | @brief | ||
| 175 | @param | ||
| 176 | |||
| 177 | @fn void tSampler_setMode (tSampler* const, PlayMode mode) | ||
| 178 | @brief | ||
| 179 | @param | ||
| 180 | |||
| 181 | @fn void tSampler_play (tSampler* const) | ||
| 182 | @brief | ||
| 183 | @param | ||
| 184 | |||
| 185 | @fn void tSampler_stop (tSampler* const) | ||
| 186 | @brief | ||
| 187 | @param | ||
| 188 | |||
| 189 | @fn void tSampler_setStart (tSampler* const, int32_t start) | ||
| 190 | @brief | ||
| 191 | @param | ||
| 192 | |||
| 193 | @fn void tSampler_setEnd (tSampler* const, int32_t end) | ||
| 194 | @brief | ||
| 195 | @param | ||
| 196 | |||
| 197 | @fn void tSampler_setLength (tSampler* const, int32_t length) | ||
| 198 | @brief | ||
| 199 | @param | ||
| 200 | |||
| 201 | @fn void tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length) | ||
| 202 | @brief | ||
| 203 | @param | ||
| 204 | |||
| 205 | @fn void tSampler_setRate (tSampler* const, float rate) | ||
| 206 | @brief | ||
| 207 | @param | ||
| 208 | |||
| 209 | @} */ | ||
| 210 | |||
| 85 | typedef enum PlayMode | 211 | typedef enum PlayMode |
| 86 | { | 212 | { |
| 87 | PlayNormal, | 213 | PlayNormal, |
| @@ -130,24 +256,74 @@ extern "C" { · 42 unmodified lines | |||
| 130 | void tSampler_free (tSampler* const); | 256 | void tSampler_free (tSampler* const); |
| 131 | 257 | ||
| 132 | float tSampler_tick (tSampler* const); | 258 | float tSampler_tick (tSampler* const); |
| 133 | |||
| 134 | void tSampler_setSample (tSampler* const, tBuffer* const); | 259 | void tSampler_setSample (tSampler* const, tBuffer* const); |
| 135 | |||
| 136 | void tSampler_setMode (tSampler* const, PlayMode mode); | 260 | void tSampler_setMode (tSampler* const, PlayMode mode); |
| 137 | |||
| 138 | void tSampler_play (tSampler* const); | 261 | void tSampler_play (tSampler* const); |
| 139 | void tSampler_stop (tSampler* const); | 262 | void tSampler_stop (tSampler* const); |
| 140 | |||
| 141 | void tSampler_setStart (tSampler* const, int32_t start); | 263 | void tSampler_setStart (tSampler* const, int32_t start); |
| 142 | void tSampler_setEnd (tSampler* const, int32_t end); | 264 | void tSampler_setEnd (tSampler* const, int32_t end); |
| 143 | void tSampler_setLength (tSampler* const, int32_t length); | 265 | void tSampler_setLength (tSampler* const, int32_t length); |
| 144 | |||
| 145 | void tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length); | 266 | void tSampler_setCrossfadeLength (tSampler* const sp, uint32_t length); |
| 146 | |||
| 147 | void tSampler_setRate (tSampler* const, float rate); | 267 | void tSampler_setRate (tSampler* const, float rate); |
| 148 | 268 | ||
| 149 | //============================================================================== | 269 | //============================================================================== |
| 150 | 270 | ||
| 271 | /*! | ||
| 272 | @defgroup tautosampler tAutoSampler | ||
| 273 | @ingroup sampling | ||
| 274 | @brief | ||
| 275 | @{ | ||
| 276 | |||
| 277 | @fn void tAutoSampler_init (tAutoSampler* const, tBuffer* const) | ||
| 278 | @brief | ||
| 279 | @param | ||
| 280 | |||
| 281 | @fn void tAutoSampler_initToPool (tAutoSampler* const, tBuffer* const, tMempool* const) | ||
| 282 | @brief | ||
| 283 | @param | ||
| 284 | |||
| 285 | @fn void tAutoSampler_free (tAutoSampler* const) | ||
| 286 | @brief | ||
| 287 | @param | ||
| 288 | |||
| 289 | @fn float tAutoSampler_tick (tAutoSampler* const, float input) | ||
| 290 | @brief | ||
| 291 | @param | ||
| 292 | |||
| 293 | @fn void tAutoSampler_setBuffer (tAutoSampler* const, tBuffer* const) | ||
| 294 | @brief | ||
| 295 | @param | ||
| 296 | |||
| 297 | @fn void tAutoSampler_setMode (tAutoSampler* const, PlayMode mode) | ||
| 298 | @brief | ||
| 299 | @param | ||
| 300 | |||
| 301 | @fn void tAutoSampler_play (tAutoSampler* const) | ||
| 302 | @brief | ||
| 303 | @param | ||
| 304 | |||
| 305 | @fn void tAutoSampler_stop (tAutoSampler* const) | ||
| 306 | @brief | ||
| 307 | @param | ||
| 308 | |||
| 309 | @fn void tAutoSampler_setThreshold (tAutoSampler* const, float thresh) | ||
| 310 | @brief | ||
| 311 | @param | ||
| 312 | |||
| 313 | @fn void tAutoSampler_setWindowSize (tAutoSampler* const, uint32_t size) | ||
| 314 | @brief | ||
| 315 | @param | ||
| 316 | |||
| 317 | @fn void tAutoSampler_setCrossfadeLength (tAutoSampler* const, uint32_t length) | ||
| 318 | @brief | ||
| 319 | @param | ||
| 320 | |||
| 321 | @fn void tAutoSampler_setRate (tAutoSampler* const, float rate) | ||
| 322 | @brief | ||
| 323 | @param | ||
| 324 | |||
| 325 | @} */ | ||
| 326 | |||
| 151 | typedef struct _tAutoSampler | 327 | typedef struct _tAutoSampler |
| 152 | { | 328 | { |
| 153 | tMempool mempool; | 329 | tMempool mempool; |
| @@ -168,18 +344,13 @@ extern "C" { · 14 unmodified lines | |||
| 168 | void tAutoSampler_free (tAutoSampler* const); | 344 | void tAutoSampler_free (tAutoSampler* const); |
| 169 | 345 | ||
| 170 | float tAutoSampler_tick (tAutoSampler* const, float input); | 346 | float tAutoSampler_tick (tAutoSampler* const, float input); |
| 171 | |||
| 172 | void tAutoSampler_setBuffer (tAutoSampler* const, tBuffer* const); | 347 | void tAutoSampler_setBuffer (tAutoSampler* const, tBuffer* const); |
| 173 | |||
| 174 | void tAutoSampler_setMode (tAutoSampler* const, PlayMode mode); | 348 | void tAutoSampler_setMode (tAutoSampler* const, PlayMode mode); |
| 175 | |||
| 176 | void tAutoSampler_play (tAutoSampler* const); | 349 | void tAutoSampler_play (tAutoSampler* const); |
| 177 | void tAutoSampler_stop (tAutoSampler* const); | 350 | void tAutoSampler_stop (tAutoSampler* const); |
| 178 | |||
| 179 | void tAutoSampler_setThreshold (tAutoSampler* const, float thresh); | 351 | void tAutoSampler_setThreshold (tAutoSampler* const, float thresh); |
| 180 | void tAutoSampler_setWindowSize (tAutoSampler* const, uint32_t size); | 352 | void tAutoSampler_setWindowSize (tAutoSampler* const, uint32_t size); |
| 181 | void tAutoSampler_setCrossfadeLength (tAutoSampler* const, uint32_t length); | 353 | void tAutoSampler_setCrossfadeLength (tAutoSampler* const, uint32_t length); |
| 182 | |||
| 183 | void tAutoSampler_setRate (tAutoSampler* const, float rate); | 354 | void tAutoSampler_setRate (tAutoSampler* const, float rate); |
| 184 | 355 | ||
| 185 | #ifdef __cplusplus | 356 | #ifdef __cplusplus |
| @@ -25,6 +25,11 @@ extern "C" { · 24 unmodified lines | |||
| 25 | #define USE_SHAPER_TABLE 1 | 25 | #define USE_SHAPER_TABLE 1 |
| 26 | #define DECAY_TABLES_USED 1 | 26 | #define DECAY_TABLES_USED 1 |
| 27 | 27 | ||
| 28 | /*! | ||
| 29 | @ingroup tables | ||
| 30 | @{ | ||
| 31 | */ | ||
| 32 | |||
| 28 | #define SINE_TABLE_SIZE 2048 | 33 | #define SINE_TABLE_SIZE 2048 |
| 29 | #define SAW_TABLE_SIZE 2048 | 34 | #define SAW_TABLE_SIZE 2048 |
| 30 | #define SQR_TABLE_SIZE 2048 | 35 | #define SQR_TABLE_SIZE 2048 |
| @@ -119,6 +124,8 @@ extern "C" { · 88 unmodified lines | |||
| 119 | extern const float_value_delta step_dd_table[]; | 124 | extern const float_value_delta step_dd_table[]; |
| 120 | extern const float slope_dd_table[]; | 125 | extern const float slope_dd_table[]; |
| 121 | 126 | ||
| 127 | /*! @} */ | ||
| 128 | |||
| 122 | //============================================================================== | 129 | //============================================================================== |
| 123 | 130 | ||
| 124 | #ifdef __cplusplus | 131 | #ifdef __cplusplus |
| @@ -72,12 +72,12 @@ void tSampleReducer_setRatio(tSampleReducer* const sr, float ratio) · 71 unmodified lines | |||
| 72 | // Oversampler | 72 | // Oversampler |
| 73 | //============================================================================================================ | 73 | //============================================================================================================ |
| 74 | // Latency is equal to the phase length (numTaps / ratio) | 74 | // Latency is equal to the phase length (numTaps / ratio) |
| 75 | void tOversampler_init (tOversampler* const osr, int ratio, oBool extraQuality) | 75 | void tOversampler_init (tOversampler* const osr, int ratio, int extraQuality) |
| 76 | { | 76 | { |
| 77 | tOversampler_initToPool(osr, ratio, extraQuality, &leaf.mempool); | 77 | tOversampler_initToPool(osr, ratio, extraQuality, &leaf.mempool); |
| 78 | } | 78 | } |
| 79 | 79 | ||
| 80 | void tOversampler_initToPool (tOversampler* const osr, int ratio, oBool extraQuality, tMempool* const mp) | 80 | void tOversampler_initToPool (tOversampler* const osr, int ratio, int extraQuality, tMempool* const mp) |
| 81 | { | 81 | { |
| 82 | _tMempool* m = *mp; | 82 | _tMempool* m = *mp; |
| 83 | _tOversampler* os = *osr = (_tOversampler*) mpool_alloc(sizeof(_tOversampler), m); | 83 | _tOversampler* os = *osr = (_tOversampler*) mpool_alloc(sizeof(_tOversampler), m); |
| @@ -55,7 +55,7 @@ void tCompressor_initToPool (tCompressor* const comp, tMempool* const mp) · 54 unmodified lines | |||
| 55 | c->tauAttack = 100; | 55 | c->tauAttack = 100; |
| 56 | c->tauRelease = 100; | 56 | c->tauRelease = 100; |
| 57 | 57 | ||
| 58 | c->isActive = OFALSE; | 58 | c->isActive = 0; |
| 59 | 59 | ||
| 60 | c->T = 0.0f; // Threshold | 60 | c->T = 0.0f; // Threshold |
| 61 | c->R = 0.5f; // compression Ratio | 61 | c->R = 0.5f; // compression Ratio |
| @@ -89,17 +89,17 @@ float tCompressor_tick(tCompressor* const comp, float in) · 27 unmodified lines | |||
| 89 | if (overshoot <= -(c->W * 0.5f)) | 89 | if (overshoot <= -(c->W * 0.5f)) |
| 90 | { | 90 | { |
| 91 | out_db = in_db; | 91 | out_db = in_db; |
| 92 | c->isActive = OFALSE; | 92 | c->isActive = 0; |
| 93 | } | 93 | } |
| 94 | else if ((overshoot > -(c->W * 0.5f)) && (overshoot < (c->W * 0.5f))) | 94 | else if ((overshoot > -(c->W * 0.5f)) && (overshoot < (c->W * 0.5f))) |
| 95 | { | 95 | { |
| 96 | out_db = in_db + slope * (powf((overshoot + c->W*0.5f),2) / (2.0f * c->W)); // .^ 2 ??? | 96 | out_db = in_db + slope * (powf((overshoot + c->W*0.5f),2) / (2.0f * c->W)); // .^ 2 ??? |
| 97 | c->isActive = OTRUE; | 97 | c->isActive = 1; |
| 98 | } | 98 | } |
| 99 | else if (overshoot >= (c->W * 0.5f)) | 99 | else if (overshoot >= (c->W * 0.5f)) |
| 100 | { | 100 | { |
| 101 | out_db = in_db + slope * overshoot; | 101 | out_db = in_db + slope * overshoot; |
| 102 | c->isActive = OTRUE; | 102 | c->isActive = 1; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | 105 | ||
| @@ -62,9 +62,9 @@ void tEnvelope_initToPool (tEnvelope* const envlp, float attack, float dec · 61 unmodified lines | |||
| 62 | if (rampIndex < 0) | 62 | if (rampIndex < 0) |
| 63 | rampIndex = 0; | 63 | rampIndex = 0; |
| 64 | 64 | ||
| 65 | env->inRamp = OFALSE; | 65 | env->inRamp = 0; |
| 66 | env->inAttack = OFALSE; | 66 | env->inAttack = 0; |
| 67 | env->inDecay = OFALSE; | 67 | env->inDecay = 0; |
| 68 | 68 | ||
| 69 | env->attackInc = env->inc_buff[attackIndex]; | 69 | env->attackInc = env->inc_buff[attackIndex]; |
| 70 | env->decayInc = env->inc_buff[decayIndex]; | 70 | env->decayInc = env->inc_buff[decayIndex]; |
| @@ -125,18 +125,18 @@ void tEnvelope_on(tEnvelope* const envlp, float velocity) · 54 unmodified lines | |||
| 125 | if (env->inAttack || env->inDecay) // In case envelope retriggered while it is still happening. | 125 | if (env->inAttack || env->inDecay) // In case envelope retriggered while it is still happening. |
| 126 | { | 126 | { |
| 127 | env->rampPhase = 0; | 127 | env->rampPhase = 0; |
| 128 | env->inRamp = OTRUE; | 128 | env->inRamp = 1; |
| 129 | env->rampPeak = env->next; | 129 | env->rampPeak = env->next; |
| 130 | } | 130 | } |
| 131 | else // Normal start. | 131 | else // Normal start. |
| 132 | { | 132 | { |
| 133 | env->inAttack = OTRUE; | 133 | env->inAttack = 1; |
| 134 | } | 134 | } |
| 135 | 135 | ||
| 136 | 136 | ||
| 137 | env->attackPhase = 0; | 137 | env->attackPhase = 0; |
| 138 | env->decayPhase = 0; | 138 | env->decayPhase = 0; |
| 139 | env->inDecay = OFALSE; | 139 | env->inDecay = 0; |
| 140 | env->gain = velocity; | 140 | env->gain = velocity; |
| 141 | } | 141 | } |
| 142 | 142 | ||
| @@ -148,8 +148,8 @@ float tEnvelope_tick(tEnvelope* const envlp) · 5 unmodified lines | |||
| 148 | { | 148 | { |
| 149 | if (env->rampPhase > UINT16_MAX) | 149 | if (env->rampPhase > UINT16_MAX) |
| 150 | { | 150 | { |
| 151 | env->inRamp = OFALSE; | 151 | env->inRamp = 0; |
| 152 | env->inAttack = OTRUE; | 152 | env->inAttack = 1; |
| 153 | env->next = 0.0f; | 153 | env->next = 0.0f; |
| 154 | } | 154 | } |
| 155 | else | 155 | else |
| @@ -166,8 +166,8 @@ float tEnvelope_tick(tEnvelope* const envlp) · 10 unmodified lines | |||
| 166 | // If attack done, time to turn around. | 166 | // If attack done, time to turn around. |
| 167 | if (env->attackPhase > UINT16_MAX) | 167 | if (env->attackPhase > UINT16_MAX) |
| 168 | { | 168 | { |
| 169 | env->inDecay = OTRUE; | 169 | env->inDecay = 1; |
| 170 | env->inAttack = OFALSE; | 170 | env->inAttack = 0; |
| 171 | env->next = env->gain * 1.0f; | 171 | env->next = env->gain * 1.0f; |
| 172 | } | 172 | } |
| 173 | else | 173 | else |
| @@ -187,13 +187,13 @@ float tEnvelope_tick(tEnvelope* const envlp) · 13 unmodified lines | |||
| 187 | // If decay done, finish. | 187 | // If decay done, finish. |
| 188 | if (env->decayPhase >= UINT16_MAX) | 188 | if (env->decayPhase >= UINT16_MAX) |
| 189 | { | 189 | { |
| 190 | env->inDecay = OFALSE; | 190 | env->inDecay = 0; |
| 191 | 191 | ||
| 192 | if (env->loop) | 192 | if (env->loop) |
| 193 | { | 193 | { |
| 194 | env->attackPhase = 0; | 194 | env->attackPhase = 0; |
| 195 | env->decayPhase = 0; | 195 | env->decayPhase = 0; |
| 196 | env->inAttack = OTRUE; | 196 | env->inAttack = 1; |
| 197 | } | 197 | } |
| 198 | else | 198 | else |
| 199 | { | 199 | { |
| @@ -266,11 +266,11 @@ void tADSR_initToPool (tADSR* const adsrenv, float attack, float decay, fl · 66 unmodified lines | |||
| 266 | 266 | ||
| 267 | adsr->next = 0.0f; | 267 | adsr->next = 0.0f; |
| 268 | 268 | ||
| 269 | adsr->inRamp = OFALSE; | 269 | adsr->inRamp = 0; |
| 270 | adsr->inAttack = OFALSE; | 270 | adsr->inAttack = 0; |
| 271 | adsr->inDecay = OFALSE; | 271 | adsr->inDecay = 0; |
| 272 | adsr->inSustain = OFALSE; | 272 | adsr->inSustain = 0; |
| 273 | adsr->inRelease = OFALSE; | 273 | adsr->inRelease = 0; |
| 274 | 274 | ||
| 275 | adsr->sustain = sustain; | 275 | adsr->sustain = sustain; |
| 276 | 276 | ||
| @@ -364,20 +364,20 @@ void tADSR_on(tADSR* const adsrenv, float velocity) · 87 unmodified lines | |||
| 364 | if ((adsr->inAttack || adsr->inDecay) || (adsr->inSustain || adsr->inRelease)) // In case ADSR retriggered while it is still happening. | 364 | if ((adsr->inAttack || adsr->inDecay) || (adsr->inSustain || adsr->inRelease)) // In case ADSR retriggered while it is still happening. |
| 365 | { | 365 | { |
| 366 | adsr->rampPhase = 0; | 366 | adsr->rampPhase = 0; |
| 367 | adsr->inRamp = OTRUE; | 367 | adsr->inRamp = 1; |
| 368 | adsr->rampPeak = adsr->next; | 368 | adsr->rampPeak = adsr->next; |
| 369 | } | 369 | } |
| 370 | else // Normal start. | 370 | else // Normal start. |
| 371 | { | 371 | { |
| 372 | adsr->inAttack = OTRUE; | 372 | adsr->inAttack = 1; |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | adsr->attackPhase = 0; | 375 | adsr->attackPhase = 0; |
| 376 | adsr->decayPhase = 0; | 376 | adsr->decayPhase = 0; |
| 377 | adsr->releasePhase = 0; | 377 | adsr->releasePhase = 0; |
| 378 | adsr->inDecay = OFALSE; | 378 | adsr->inDecay = 0; |
| 379 | adsr->inSustain = OFALSE; | 379 | adsr->inSustain = 0; |
| 380 | adsr->inRelease = OFALSE; | 380 | adsr->inRelease = 0; |
| 381 | adsr->gain = velocity; | 381 | adsr->gain = velocity; |
| 382 | } | 382 | } |
| 383 | 383 | ||
| @@ -387,10 +387,10 @@ void tADSR_off(tADSR* const adsrenv) · 3 unmodified lines | |||
| 387 | 387 | ||
| 388 | if (adsr->inRelease) return; | 388 | if (adsr->inRelease) return; |
| 389 | 389 | ||
| 390 | adsr->inAttack = OFALSE; | 390 | adsr->inAttack = 0; |
| 391 | adsr->inDecay = OFALSE; | 391 | adsr->inDecay = 0; |
| 392 | adsr->inSustain = OFALSE; | 392 | adsr->inSustain = 0; |
| 393 | adsr->inRelease = OTRUE; | 393 | adsr->inRelease = 1; |
| 394 | 394 | ||
| 395 | adsr->releasePeak = adsr->next; | 395 | adsr->releasePeak = adsr->next; |
| 396 | } | 396 | } |
| @@ -404,8 +404,8 @@ float tADSR_tick(tADSR* const adsrenv) · 7 unmodified lines | |||
| 404 | { | 404 | { |
| 405 | if (adsr->rampPhase > UINT16_MAX) | 405 | if (adsr->rampPhase > UINT16_MAX) |
| 406 | { | 406 | { |
| 407 | adsr->inRamp = OFALSE; | 407 | adsr->inRamp = 0; |
| 408 | adsr->inAttack = OTRUE; | 408 | adsr->inAttack = 1; |
| 409 | adsr->next = 0.0f; | 409 | adsr->next = 0.0f; |
| 410 | } | 410 | } |
| 411 | else | 411 | else |
| @@ -422,8 +422,8 @@ float tADSR_tick(tADSR* const adsrenv) · 10 unmodified lines | |||
| 422 | // If attack done, time to turn around. | 422 | // If attack done, time to turn around. |
| 423 | if (adsr->attackPhase > UINT16_MAX) | 423 | if (adsr->attackPhase > UINT16_MAX) |
| 424 | { | 424 | { |
| 425 | adsr->inDecay = OTRUE; | 425 | adsr->inDecay = 1; |
| 426 | adsr->inAttack = OFALSE; | 426 | adsr->inAttack = 0; |
| 427 | adsr->next = adsr->gain * 1.0f; | 427 | adsr->next = adsr->gain * 1.0f; |
| 428 | } | 428 | } |
| 429 | else | 429 | else |
| @@ -443,8 +443,8 @@ float tADSR_tick(tADSR* const adsrenv) · 13 unmodified lines | |||
| 443 | // If decay done, sustain. | 443 | // If decay done, sustain. |
| 444 | if (adsr->decayPhase >= UINT16_MAX) | 444 | if (adsr->decayPhase >= UINT16_MAX) |
| 445 | { | 445 | { |
| 446 | adsr->inDecay = OFALSE; | 446 | adsr->inDecay = 0; |
| 447 | adsr->inSustain = OTRUE; | 447 | adsr->inSustain = 1; |
| 448 | adsr->next = adsr->gain * adsr->sustain; | 448 | adsr->next = adsr->gain * adsr->sustain; |
| 449 | } | 449 | } |
| 450 | 450 | ||
| @@ -467,7 +467,7 @@ float tADSR_tick(tADSR* const adsrenv) · 16 unmodified lines | |||
| 467 | // If release done, finish. | 467 | // If release done, finish. |
| 468 | if (adsr->releasePhase >= UINT16_MAX) | 468 | if (adsr->releasePhase >= UINT16_MAX) |
| 469 | { | 469 | { |
| 470 | adsr->inRelease = OFALSE; | 470 | adsr->inRelease = 0; |
| 471 | adsr->next = 0.0f; | 471 | adsr->next = 0.0f; |
| 472 | } | 472 | } |
| 473 | else { | 473 | else { |
| @@ -222,7 +222,7 @@ void tTwoPole_setA2(tTwoPole* const ft, float a2) · 221 unmodified lines | |||
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | 224 | ||
| 225 | void tTwoPole_setResonance(tTwoPole* const ft, float frequency, float radius, oBool normalize) | 225 | void tTwoPole_setResonance(tTwoPole* const ft, float frequency, float radius, int normalize) |
| 226 | { | 226 | { |
| 227 | _tTwoPole* f = *ft; | 227 | _tTwoPole* f = *ft; |
| 228 | 228 | ||
| @@ -636,7 +636,7 @@ float tBiQuad_tick(tBiQuad* const ft, float input) · 407 unmodified lines | |||
| 636 | return out; | 636 | return out; |
| 637 | } | 637 | } |
| 638 | 638 | ||
| 639 | void tBiQuad_setResonance(tBiQuad* const ft, float freq, float radius, oBool normalize) | 639 | void tBiQuad_setResonance(tBiQuad* const ft, float freq, float radius, int normalize) |
| 640 | { | 640 | { |
| 641 | _tBiQuad* f = *ft; | 641 | _tBiQuad* f = *ft; |
| 642 | 642 | ||
| @@ -41,9 +41,9 @@ void t808Cowbell_initToPool (t808Cowbell* const cowbellInst, int use · 40 unmodified lines | |||
| 41 | 41 | ||
| 42 | tSVF_initToPool(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f, mp); | 42 | tSVF_initToPool(&cowbell->bandpassStick, SVFTypeBandpass, 1800, 1.0f, mp); |
| 43 | 43 | ||
| 44 | tEnvelope_initToPool(&cowbell->envGain, 5.0f, 100.0f, OFALSE, mp); | 44 | tEnvelope_initToPool(&cowbell->envGain, 5.0f, 100.0f, 0, mp); |
| 45 | 45 | ||
| 46 | tEnvelope_initToPool(&cowbell->envFilter, 5.0, 100.0f, OFALSE, mp); | 46 | tEnvelope_initToPool(&cowbell->envFilter, 5.0, 100.0f, 0, mp); |
| 47 | 47 | ||
| 48 | tHighpass_initToPool(&cowbell->highpass, 1000.0f, mp); | 48 | tHighpass_initToPool(&cowbell->highpass, 1000.0f, mp); |
| 49 | 49 | ||
| @@ -166,8 +166,8 @@ void t808Hihat_initToPool (t808Hihat* const hihatInst, tMempool* const mp) · 116 unmodified lines | |||
| 166 | tSVF_initToPool(&hihat->bandpassStick, SVFTypeBandpass,2500.0f,1.2f, mp); | 166 | tSVF_initToPool(&hihat->bandpassStick, SVFTypeBandpass,2500.0f,1.2f, mp); |
| 167 | tSVF_initToPool(&hihat->bandpassOsc, SVFTypeBandpass,3500.0f,0.3f, mp); | 167 | tSVF_initToPool(&hihat->bandpassOsc, SVFTypeBandpass,3500.0f,0.3f, mp); |
| 168 | 168 | ||
| 169 | tEnvelope_initToPool(&hihat->envGain, 0.0f, 50.0f, OFALSE, mp); | 169 | tEnvelope_initToPool(&hihat->envGain, 0.0f, 50.0f, 0, mp); |
| 170 | tEnvelope_initToPool(&hihat->envStick, 0.0f, 7.0f, OFALSE, mp); | 170 | tEnvelope_initToPool(&hihat->envStick, 0.0f, 7.0f, 0, mp); |
| 171 | 171 | ||
| 172 | 172 | ||
| 173 | tHighpass_initToPool(&hihat->highpass, 7000.0f, mp); | 173 | tHighpass_initToPool(&hihat->highpass, 7000.0f, mp); |
| @@ -329,9 +329,9 @@ void t808Snare_initToPool (t808Snare* const snareInst, tMempool* const mp) · 155 unmodified lines | |||
| 329 | 329 | ||
| 330 | tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f); | 330 | tTriangle_setFreq(&snare->tone[i], ratio[i] * 400.0f); |
| 331 | tSVF_initToPool(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f, mp); | 331 | tSVF_initToPool(&snare->toneLowpass[i], SVFTypeLowpass, 4000, 1.0f, mp); |
| 332 | tEnvelope_initToPool(&snare->toneEnvOsc[i], 0.0f, 50.0f, OFALSE, mp); | 332 | tEnvelope_initToPool(&snare->toneEnvOsc[i], 0.0f, 50.0f, 0, mp); |
| 333 | tEnvelope_initToPool(&snare->toneEnvGain[i], 1.0f, 150.0f, OFALSE, mp); | 333 | tEnvelope_initToPool(&snare->toneEnvGain[i], 1.0f, 150.0f, 0, mp); |
| 334 | tEnvelope_initToPool(&snare->toneEnvFilter[i], 1.0f, 2000.0f, OFALSE, mp); | 334 | tEnvelope_initToPool(&snare->toneEnvFilter[i], 1.0f, 2000.0f, 0, mp); |
| 335 | 335 | ||
| 336 | snare->toneGain[i] = 0.5f; | 336 | snare->toneGain[i] = 0.5f; |
| 337 | } | 337 | } |
| @@ -341,8 +341,8 @@ void t808Snare_initToPool (t808Snare* const snareInst, tMempool* const mp) · 3 unmodified lines | |||
| 341 | snare->noiseFilterFreq = 3000.0f; | 341 | snare->noiseFilterFreq = 3000.0f; |
| 342 | tNoise_initToPool(&snare->noiseOsc, WhiteNoise, mp); | 342 | tNoise_initToPool(&snare->noiseOsc, WhiteNoise, mp); |
| 343 | tSVF_initToPool(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f, mp); | 343 | tSVF_initToPool(&snare->noiseLowpass, SVFTypeLowpass, 12000.0f, 0.8f, mp); |
| 344 | tEnvelope_initToPool(&snare->noiseEnvGain, 0.0f, 100.0f, OFALSE, mp); | 344 | tEnvelope_initToPool(&snare->noiseEnvGain, 0.0f, 100.0f, 0, mp); |
| 345 | tEnvelope_initToPool(&snare->noiseEnvFilter, 0.0f, 1000.0f, OFALSE, mp); | 345 | tEnvelope_initToPool(&snare->noiseEnvFilter, 0.0f, 1000.0f, 0, mp); |
| 346 | snare->noiseGain = 1.0f; | 346 | snare->noiseGain = 1.0f; |
| 347 | } | 347 | } |
| 348 | 348 | ||
| @@ -475,11 +475,11 @@ void t808Kick_initToPool (t808Kick* const kickInst, tMempool* const mp) · 126 unmodified lines | |||
| 475 | kick->chirpRatioMinusOne = 3.3f; | 475 | kick->chirpRatioMinusOne = 3.3f; |
| 476 | tCycle_setFreq(&kick->tone, 50.0f); | 476 | tCycle_setFreq(&kick->tone, 50.0f); |
| 477 | tSVF_initToPool(&kick->toneLowpass, SVFTypeLowpass, 2000.0f, 0.5f, mp); | 477 | tSVF_initToPool(&kick->toneLowpass, SVFTypeLowpass, 2000.0f, 0.5f, mp); |
| 478 | tEnvelope_initToPool(&kick->toneEnvOscChirp, 0.0f, 20.0f, OFALSE, mp); | 478 | tEnvelope_initToPool(&kick->toneEnvOscChirp, 0.0f, 20.0f, 0, mp); |
| 479 | tEnvelope_initToPool(&kick->toneEnvOscSigh, 0.0f, 2500.0f, OFALSE, mp); | 479 | tEnvelope_initToPool(&kick->toneEnvOscSigh, 0.0f, 2500.0f, 0, mp); |
| 480 | tEnvelope_initToPool(&kick->toneEnvGain, 0.0f, 800.0f, OFALSE, mp); | 480 | tEnvelope_initToPool(&kick->toneEnvGain, 0.0f, 800.0f, 0, mp); |
| 481 | tNoise_initToPool(&kick->noiseOsc, PinkNoise, mp); | 481 | tNoise_initToPool(&kick->noiseOsc, PinkNoise, mp); |
| 482 | tEnvelope_initToPool(&kick->noiseEnvGain, 0.0f, 1.0f, OFALSE, mp); | 482 | tEnvelope_initToPool(&kick->noiseEnvGain, 0.0f, 1.0f, 0, mp); |
| 483 | kick->noiseGain = 0.3f; | 483 | kick->noiseGain = 0.3f; |
| 484 | } | 484 | } |
| 485 | 485 | ||
| @@ -361,15 +361,15 @@ int LEAF_clipInt(int min, int val, int max) · 360 unmodified lines | |||
| 361 | } | 361 | } |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | oBool LEAF_isPrime(uint64_t number ) | 364 | int LEAF_isPrime(uint64_t number ) |
| 365 | { | 365 | { |
| 366 | if ( number == 2 ) return OTRUE; | 366 | if ( number == 2 ) return 1; |
| 367 | if ( number & 1 ) { | 367 | if ( number & 1 ) { |
| 368 | for ( int i=3; i<(int)sqrt((double)number)+1; i+=2 ) | 368 | for ( int i=3; i<(int)sqrt((double)number)+1; i+=2 ) |
| 369 | if ( (number % i) == 0 ) return OFALSE; | 369 | if ( (number % i) == 0 ) return 0; |
| 370 | return OTRUE; // prime | 370 | return 1; // prime |
| 371 | } | 371 | } |
| 372 | else return OFALSE; // even | 372 | else return 0; // even |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | // Adapted from MusicDSP: http://www.musicdsp.org/showone.php?id=238 | 375 | // Adapted from MusicDSP: http://www.musicdsp.org/showone.php?id=238 |
| @@ -31,7 +31,7 @@ void tStack_initToPool (tStack* const stack, tMempool* const mp) · 30 unmodified lines | |||
| 31 | _tStack* ns = *stack = (_tStack*) mpool_alloc(sizeof(_tStack), m); | 31 | _tStack* ns = *stack = (_tStack*) mpool_alloc(sizeof(_tStack), m); |
| 32 | ns->mempool = m; | 32 | ns->mempool = m; |
| 33 | 33 | ||
| 34 | ns->ordered = OFALSE; | 34 | ns->ordered = 0; |
| 35 | ns->size = 0; | 35 | ns->size = 0; |
| 36 | ns->pos = 0; | 36 | ns->pos = 0; |
| 37 | ns->capacity = STACK_SIZE; | 37 | ns->capacity = STACK_SIZE; |
| @@ -287,14 +287,14 @@ void tPoly_initToPool (tPoly* const polyh, int maxNumVoices, tMemp · 249 unmodified lines | |||
| 287 | 287 | ||
| 288 | poly->ramps = (tRamp*) mpool_alloc(sizeof(tRamp) * poly->maxNumVoices, m); | 288 | poly->ramps = (tRamp*) mpool_alloc(sizeof(tRamp) * poly->maxNumVoices, m); |
| 289 | poly->rampVals = (float*) mpool_alloc(sizeof(float) * poly->maxNumVoices, m); | 289 | poly->rampVals = (float*) mpool_alloc(sizeof(float) * poly->maxNumVoices, m); |
| 290 | poly->firstReceived = (oBool*) mpool_alloc(sizeof(oBool) * poly->maxNumVoices, m); | 290 | poly->firstReceived = (int*) mpool_alloc(sizeof(int) * poly->maxNumVoices, m); |
| 291 | poly->voices = (int**) mpool_alloc(sizeof(int*) * poly->maxNumVoices, m); | 291 | poly->voices = (int**) mpool_alloc(sizeof(int*) * poly->maxNumVoices, m); |
| 292 | 292 | ||
| 293 | for (int i = 0; i < poly->maxNumVoices; ++i) | 293 | for (int i = 0; i < poly->maxNumVoices; ++i) |
| 294 | { | 294 | { |
| 295 | poly->voices[i] = (int*) mpool_alloc(sizeof(int) * 2, m); | 295 | poly->voices[i] = (int*) mpool_alloc(sizeof(int) * 2, m); |
| 296 | poly->voices[i][0] = -1; | 296 | poly->voices[i][0] = -1; |
| 297 | poly->firstReceived[i] = OFALSE; | 297 | poly->firstReceived[i] = 0; |
| 298 | 298 | ||
| 299 | tRamp_initToPool(&poly->ramps[i], poly->glideTime, 1, mp); | 299 | tRamp_initToPool(&poly->ramps[i], poly->glideTime, 1, mp); |
| 300 | } | 300 | } |
| @@ -305,7 +305,7 @@ void tPoly_initToPool (tPoly* const polyh, int maxNumVoices, tMemp · 4 unmodified lines | |||
| 305 | tStack_initToPool(&poly->stack, mp); | 305 | tStack_initToPool(&poly->stack, mp); |
| 306 | tStack_initToPool(&poly->orderStack, mp); | 306 | tStack_initToPool(&poly->orderStack, mp); |
| 307 | 307 | ||
| 308 | poly->pitchGlideIsActive = OFALSE; | 308 | poly->pitchGlideIsActive = 0; |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | void tPoly_free (tPoly* const polyh) | 311 | void tPoly_free (tPoly* const polyh) |
| @@ -369,7 +369,7 @@ int tPoly_noteOn(tPoly* const polyh, int note, uint8_t vel) · 57 unmodified lines | |||
| 369 | tStack_add(&poly->stack, note); | 369 | tStack_add(&poly->stack, note); |
| 370 | 370 | ||
| 371 | int alteredVoice = -1; | 371 | int alteredVoice = -1; |
| 372 | oBool found = OFALSE; | 372 | int found = 0; |
| 373 | for (int i = 0; i < poly->numVoices; i++) | 373 | for (int i = 0; i < poly->numVoices; i++) |
| 374 | { | 374 | { |
| 375 | if (poly->voices[i][0] < 0) // if inactive voice, give this note to voice | 375 | if (poly->voices[i][0] < 0) // if inactive voice, give this note to voice |
| @@ -377,10 +377,10 @@ int tPoly_noteOn(tPoly* const polyh, int note, uint8_t vel) · 1 unmodified line | |||
| 377 | if (!poly->firstReceived[i] || !poly->pitchGlideIsActive) | 377 | if (!poly->firstReceived[i] || !poly->pitchGlideIsActive) |
| 378 | { | 378 | { |
| 379 | tRamp_setVal(&poly->ramps[i], note); | 379 | tRamp_setVal(&poly->ramps[i], note); |
| 380 | poly->firstReceived[i] = OTRUE; | 380 | poly->firstReceived[i] = 1; |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | found = OTRUE; | 383 | found = 1; |
| 384 | 384 | ||
| 385 | poly->voices[i][0] = note; | 385 | poly->voices[i][0] = note; |
| 386 | poly->voices[i][1] = vel; | 386 | poly->voices[i][1] = vel; |
| @@ -541,7 +541,7 @@ void tPoly_setNumVoices(tPoly* const polyh, uint8_t numVoices) · 154 unmodified lines | |||
| 541 | poly->numVoices = (numVoices > poly->maxNumVoices) ? poly->maxNumVoices : numVoices; | 541 | poly->numVoices = (numVoices > poly->maxNumVoices) ? poly->maxNumVoices : numVoices; |
| 542 | } | 542 | } |
| 543 | 543 | ||
| 544 | void tPoly_setPitchGlideActive(tPoly* const polyh, oBool isActive) | 544 | void tPoly_setPitchGlideActive(tPoly* const polyh, int isActive) |
| 545 | { | 545 | { |
| 546 | _tPoly* poly = *polyh; | 546 | _tPoly* poly = *polyh; |
| 547 | poly->pitchGlideIsActive = isActive; | 547 | poly->pitchGlideIsActive = isActive; |
| @@ -666,13 +666,13 @@ int tSimplePoly_noteOn(tSimplePoly* const polyh, int note, uint8_t vel) · 118 unmodified lines | |||
| 666 | else | 666 | else |
| 667 | { | 667 | { |
| 668 | alteredVoice = -1; | 668 | alteredVoice = -1; |
| 669 | oBool found = OFALSE; | 669 | int found = 0; |
| 670 | for (int i = 0; i < poly->numVoices; i++) | 670 | for (int i = 0; i < poly->numVoices; i++) |
| 671 | { | 671 | { |
| 672 | if (poly->voices[i][0] == -1) // if inactive voice, give this note to voice | 672 | if (poly->voices[i][0] == -1) // if inactive voice, give this note to voice |
| 673 | { | 673 | { |
| 674 | 674 | ||
| 675 | found = OTRUE; | 675 | found = 1; |
| 676 | 676 | ||
| 677 | poly->voices[i][0] = note; | 677 | poly->voices[i][0] = note; |
| 678 | poly->voices[i][1] = vel; | 678 | poly->voices[i][1] = vel; |
| @@ -693,7 +693,7 @@ int tSimplePoly_noteOn(tSimplePoly* const polyh, int note, uint8_t vel) · 14 unmodified lines | |||
| 693 | if (poly->voices[i][0] == -2) // if voice is released but still sounding, take over this voice | 693 | if (poly->voices[i][0] == -2) // if voice is released but still sounding, take over this voice |
| 694 | { | 694 | { |
| 695 | 695 | ||
| 696 | found = OTRUE; | 696 | found = 1; |
| 697 | 697 | ||
| 698 | poly->voices[i][0] = note; | 698 | poly->voices[i][0] = note; |
| 699 | poly->voices[i][1] = vel; | 699 | poly->voices[i][1] = vel; |
| @@ -354,76 +354,6 @@ void tSawtoothSampleRateChanged (tSawtooth* const cy) · 353 unmodified lines | |||
| 354 | c->inc = c->freq * leaf.invSampleRate; | 354 | c->inc = c->freq * leaf.invSampleRate; |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | //======================================================================== | ||
| 358 | // Sine | ||
| 359 | void tSine_init(tSine* const cy, int size) | ||
| 360 | { | ||
| 361 | tSine_initToPool(cy, size, &leaf.mempool); | ||
| 362 | } | ||
| 363 | |||
| 364 | void tSine_initToPool (tSine* const cy, int size, tMempool* const mp) | ||
| 365 | { | ||
| 366 | _tMempool* m = *mp; | ||
| 367 | _tSine* c = *cy = (_tSine*) mpool_alloc(sizeof(_tSine), m); | ||
| 368 | c->mempool = m; | ||
| 369 | |||
| 370 | c->size = size; | ||
| 371 | c->sine = (float*) mpool_alloc(sizeof(float) * c->size, m); | ||
| 372 | LEAF_generate_sine(c->sine, size); | ||
| 373 | c->inc = 0.0f; | ||
| 374 | c->phase = 0.0f; | ||
| 375 | } | ||
| 376 | |||
| 377 | void tSine_free (tSine* const cy) | ||
| 378 | { | ||
| 379 | _tSine* c = *cy; | ||
| 380 | |||
| 381 | mpool_free((char*)c->sine, c->mempool); | ||
| 382 | mpool_free((char*)c, c->mempool); | ||
| 383 | } | ||
| 384 | |||
| 385 | void tSine_setFreq(tSine* const cy, float freq) | ||
| 386 | { | ||
| 387 | _tSine* c = *cy; | ||
| 388 | |||
| 389 | c->freq = freq; | ||
| 390 | c->inc = freq * leaf.invSampleRate; | ||
| 391 | } | ||
| 392 | |||
| 393 | float tSine_tick(tSine* const cy) | ||
| 394 | { | ||
| 395 | _tSine* c = *cy; | ||
| 396 | float temp; | ||
| 397 | int intPart; | ||
| 398 | float fracPart; | ||
| 399 | float samp0; | ||
| 400 | float samp1; | ||
| 401 | |||
| 402 | // Phasor increment | ||
| 403 | c->phase += c->inc; | ||
| 404 | while (c->phase >= 1.0f) c->phase -= 1.0f; | ||
| 405 | while (c->phase < 0.0f) c->phase += 1.0f; | ||
| 406 | |||
| 407 | // Wavetable synthesis | ||
| 408 | |||
| 409 | temp = c->size * c->phase; | ||
| 410 | intPart = (int)temp; | ||
| 411 | fracPart = temp - (float)intPart; | ||
| 412 | samp0 = c->sine[intPart]; | ||
| 413 | if (++intPart >= c->size) intPart = 0; | ||
| 414 | samp1 = c->sine[intPart]; | ||
| 415 | |||
| 416 | return (samp0 + (samp1 - samp0) * fracPart); | ||
| 417 | |||
| 418 | } | ||
| 419 | |||
| 420 | void tSineSampleRateChanged (tSine* const cy) | ||
| 421 | { | ||
| 422 | _tSine* c = *cy; | ||
| 423 | |||
| 424 | c->inc = c->freq * leaf.invSampleRate; | ||
| 425 | } | ||
| 426 | |||
| 427 | //============================================================================== | 357 | //============================================================================== |
| 428 | 358 | ||
| 429 | /* tTri: Anti-aliased Triangle waveform. */ | 359 | /* tTri: Anti-aliased Triangle waveform. */ |
| @@ -75,15 +75,15 @@ · 74 unmodified lines | |||
| 75 | 75 | ||
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | /*! \mainpage LEAF | 78 | /*! @mainpage LEAF |
| 79 | * | 79 | * |
| 80 | * \section intro_sec Introduction | 80 | * @section intro_sec Introduction |
| 81 | * | 81 | * |
| 82 | * This is the work in progress documentation of LEAF. | 82 | * This is the work in progress documentation of LEAF. |
| 83 | * | 83 | * |
| 84 | * \section install_sec Installation | 84 | * @section install_sec Installation |
| 85 | * | 85 | * |
| 86 | * \subsection step1 Step 1: Opening the box | 86 | * @subsection step1 Step 1: Opening the box |
| 87 | * | 87 | * |
| 88 | * etc... | 88 | * etc... |
| 89 | */ | 89 | */ |
| @@ -106,6 +106,7 @@ · 16 unmodified lines | |||
| 106 | * @defgroup electrical Electrical Models | 106 | * @defgroup electrical Electrical Models |
| 107 | * @defgroup mempool Mempool | 107 | * @defgroup mempool Mempool |
| 108 | * @defgroup math Math | 108 | * @defgroup math Math |
| 109 | * @defgroup tables Tables | ||
| 109 | */ | 110 | */ |
| 110 | 111 | ||
| 111 | #ifdef __cplusplus | 112 | #ifdef __cplusplus |
| @@ -113,8 +114,8 @@ extern "C" { · 1 unmodified line | |||
| 113 | #endif | 114 | #endif |
| 114 | 115 | ||
| 115 | /*! | 116 | /*! |
| 116 | * @ingroup leaf | 117 | @ingroup leaf |
| 117 | * @{ | 118 | @{ |
| 118 | */ | 119 | */ |
| 119 | 120 | ||
| 120 | //! Initialize the LEAF instance. | 121 | //! Initialize the LEAF instance. |
| @@ -143,9 +144,7 @@ extern "C" { · 22 unmodified lines | |||
| 143 | // __attribute__((weak)) | 144 | // __attribute__((weak)) |
| 144 | uint8_t LEAF_error(uint8_t whichone); | 145 | uint8_t LEAF_error(uint8_t whichone); |
| 145 | 146 | ||
| 146 | /*! | 147 | /*! @} */ |
| 147 | * @} | ||
| 148 | */ | ||
| 149 | 148 | ||
| 150 | #ifdef __cplusplus | 149 | #ifdef __cplusplus |
| 151 | } | 150 | } |