History

Synced cpp and c leaf source.

mulshine committed 7 years ago

Commit 9dffd7c1 parent 20802a81 file · +12 −4Browse files

Unified · Split

LEAF/Src_cpp/leaf-oscillator.cpp+12−4
@@ -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
312void tPhasor_free(tPhasor* const p)313void 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 else431 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
455void tTriangle_free(tTriangle* const c)459void 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 else564 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
580void tSquare_free(tSquare* const c)587void 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 synthesis635 // 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 else691 else if (c->freq <= 24000.0f)
684 {692 {
685 out = c->table[T20480][idx];693 out = c->table[T20480][idx];
686 }694 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t