Unified · Split
| @@ -307,6 +307,7 @@ void tPhasor_init(tPhasor* const p) · 306 unmodified lines | |||
| 307 | { | 307 | { |
| 308 | p->phase = 0.0f; | 308 | p->phase = 0.0f; |
| 309 | p->inc = 0.0f; | 309 | p->inc = 0.0f; |
| 310 | |||
| 310 | } | 311 | } |
| 311 | 312 | ||
| 312 | void tPhasor_free(tPhasor* const p) | 313 | void tPhasor_free(tPhasor* const p) |
| @@ -427,7 +428,7 @@ float tSawtooth_tick(tSawtooth* const c) · 114 unmodified lines | |||
| 427 | w = ((20480.0f - c->freq) * INV_10240); | 428 | w = ((20480.0f - c->freq) * INV_10240); |
| 428 | out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w)); | 429 | out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w)); |
| 429 | } | 430 | } |
| 430 | else | 431 | else if (c->freq <= 24000.0f) |
| 431 | { | 432 | { |
| 432 | out = c->table[T20480][idx]; | 433 | out = c->table[T20480][idx]; |
| 433 | } | 434 | } |
| @@ -450,6 +451,9 @@ void tTriangle_init(tTriangle* const c) · 16 unmodified lines | |||
| 450 | { | 451 | { |
| 451 | c->inc = 0.0f; | 452 | c->inc = 0.0f; |
| 452 | c->phase = 0.0f; | 453 | c->phase = 0.0f; |
| 454 | c->tsize = 2048; | ||
| 455 | |||
| 456 | tTriangle_setTableSize(c, c->tsize); | ||
| 453 | } | 457 | } |
| 454 | 458 | ||
| 455 | void tTriangle_free(tTriangle* const c) | 459 | void tTriangle_free(tTriangle* const c) |
| @@ -557,7 +561,7 @@ float tTriangle_tick(tTriangle* const c) · 101 unmodified lines | |||
| 557 | w = ((20480.0f - c->freq) * INV_10240); | 561 | w = ((20480.0f - c->freq) * INV_10240); |
| 558 | out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w)); | 562 | out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w)); |
| 559 | } | 563 | } |
| 560 | else | 564 | else if (c->freq <= 24000.0f) |
| 561 | { | 565 | { |
| 562 | out = c->table[T20480][idx]; | 566 | out = c->table[T20480][idx]; |
| 563 | } | 567 | } |
| @@ -575,6 +579,9 @@ void tSquare_init(tSquare* const c) · 11 unmodified lines | |||
| 575 | { | 579 | { |
| 576 | c->inc = 0.0f; | 580 | c->inc = 0.0f; |
| 577 | c->phase = 0.0f; | 581 | c->phase = 0.0f; |
| 582 | c->tsize = 2048; | ||
| 583 | |||
| 584 | tSquare_setTableSize(c, c->tsize); | ||
| 578 | } | 585 | } |
| 579 | 586 | ||
| 580 | void tSquare_free(tSquare* const c) | 587 | void tSquare_free(tSquare* const c) |
| @@ -622,8 +629,9 @@ float tSquare_tick(tSquare* const c) · 41 unmodified lines | |||
| 622 | 629 | ||
| 623 | float out = 0.0f; | 630 | float out = 0.0f; |
| 624 | float w = 0.0f; | 631 | float w = 0.0f; |
| 632 | |||
| 625 | int idx = (int)(c->phase * c->tsize); | 633 | int idx = (int)(c->phase * c->tsize); |
| 626 | 634 | ||
| 627 | // Wavetable synthesis | 635 | // Wavetable synthesis |
| 628 | 636 | ||
| 629 | if (c->freq <= 20.0f) | 637 | if (c->freq <= 20.0f) |
| @@ -680,7 +688,7 @@ float tSquare_tick(tSquare* const c) · 50 unmodified lines | |||
| 680 | w = ((20480.0f - c->freq) * INV_10240); | 688 | w = ((20480.0f - c->freq) * INV_10240); |
| 681 | out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w)); | 689 | out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w)); |
| 682 | } | 690 | } |
| 683 | else | 691 | else if (c->freq <= 24000.0f) |
| 684 | { | 692 | { |
| 685 | out = c->table[T20480][idx]; | 693 | out = c->table[T20480][idx]; |
| 686 | } | 694 | } |