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
307307 {
308308 p->phase = 0.0f;
309309 p->inc = 0.0f;
310+
310311 }
311312
312313 void tPhasor_free(tPhasor* const p)
@@ -427,7 +428,7 @@ float tSawtooth_tick(tSawtooth* const c) · 114 unmodified lines
427428 w = ((20480.0f - c->freq) * INV_10240);
428429 out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w));
429430 }
430− else
431+ else if (c->freq <= 24000.0f)
431432 {
432433 out = c->table[T20480][idx];
433434 }
@@ -450,6 +451,9 @@ void tTriangle_init(tTriangle* const c) · 16 unmodified lines
450451 {
451452 c->inc = 0.0f;
452453 c->phase = 0.0f;
454+ c->tsize = 2048;
455+
456+ tTriangle_setTableSize(c, c->tsize);
453457 }
454458
455459 void tTriangle_free(tTriangle* const c)
@@ -557,7 +561,7 @@ float tTriangle_tick(tTriangle* const c) · 101 unmodified lines
557561 w = ((20480.0f - c->freq) * INV_10240);
558562 out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w));
559563 }
560− else
564+ else if (c->freq <= 24000.0f)
561565 {
562566 out = c->table[T20480][idx];
563567 }
@@ -575,6 +579,9 @@ void tSquare_init(tSquare* const c) · 11 unmodified lines
575579 {
576580 c->inc = 0.0f;
577581 c->phase = 0.0f;
582+ c->tsize = 2048;
583+
584+ tSquare_setTableSize(c, c->tsize);
578585 }
579586
580587 void tSquare_free(tSquare* const c)
@@ -622,8 +629,9 @@ float tSquare_tick(tSquare* const c) · 41 unmodified lines
622629
623630 float out = 0.0f;
624631 float w = 0.0f;
632+
625633 int idx = (int)(c->phase * c->tsize);
626−
634+
627635 // Wavetable synthesis
628636
629637 if (c->freq <= 20.0f)
@@ -680,7 +688,7 @@ float tSquare_tick(tSquare* const c) · 50 unmodified lines
680688 w = ((20480.0f - c->freq) * INV_10240);
681689 out = (c->table[T10240][idx] * w) + (c->table[T20480][idx] * (1.0f - w));
682690 }
683− else
691+ else if (c->freq <= 24000.0f)
684692 {
685693 out = c->table[T20480][idx];
686694 }

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