Unified · Split
| @@ -556,7 +556,7 @@ void LEAF_generate_square(float* buffer, float basefreq, int size, LEAF* const l · 555 unmodified lines | |||
| 556 | //0.001 base gives a good curve that goes from 1 to near zero | 556 | //0.001 base gives a good curve that goes from 1 to near zero |
| 557 | void LEAF_generate_exp(float* buffer, float base, float start, float end, float offset, int size) | 557 | void LEAF_generate_exp(float* buffer, float base, float start, float end, float offset, int size) |
| 558 | { | 558 | { |
| 559 | float increment = (end - start) / (float)size; | 559 | float increment = (end - start) / (float)(size-1); |
| 560 | float x = start; | 560 | float x = start; |
| 561 | for (int i = 0; i < size; i++) | 561 | for (int i = 0; i < size; i++) |
| 562 | { | 562 | { |
| @@ -565,17 +565,17 @@ void LEAF_generate_exp(float* buffer, float base, float start, float end, float · 2 unmodified lines | |||
| 565 | } | 565 | } |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | //0.001 base gives a good curve that goes from 1 to near zero | 568 | // |
| 569 | void LEAF_generate_table_skew_non_sym(float* buffer, float start, float end, float center, int size) | 569 | void LEAF_generate_table_skew_non_sym(float* buffer, float start, float end, float center, int size) |
| 570 | { | 570 | { |
| 571 | float skew = logf (0.5f) / logf ((center - start) / (end - start)); | 571 | double skew = log (0.5) / log ((center - start) / (end - start)); |
| 572 | float increment = (end - start) / (float)size; | 572 | double increment = 1.0 / (double)(size-1); |
| 573 | float x = start; | 573 | double x = 0.0; |
| 574 | float proportion = 0; | 574 | double proportion = 0.0; |
| 575 | for (int i = 0; i < size; i++) | 575 | for (int i = 0; i < size; i++) |
| 576 | { | 576 | { |
| 577 | proportion = expf (logf (x) / skew); | 577 | proportion = exp (log(x) / skew); |
| 578 | buffer[i] = start + (end - start) * proportion; | 578 | buffer[i] = (float)(start + (end - start) * proportion); |
| 579 | x += increment; | 579 | x += increment; |
| 580 | } | 580 | } |
| 581 | } | 581 | } |
| @@ -583,7 +583,7 @@ void LEAF_generate_table_skew_non_sym(float* buffer, float start, float end, flo · 1 unmodified line | |||
| 583 | 583 | ||
| 584 | void LEAF_generate_atodb(float* buffer, int size) | 584 | void LEAF_generate_atodb(float* buffer, int size) |
| 585 | { | 585 | { |
| 586 | float increment = 1.0f / (float)size; | 586 | float increment = 1.0f / (float)(size-1); |
| 587 | float x = 0.0f; | 587 | float x = 0.0f; |
| 588 | for (int i = 0; i < size; i++) | 588 | for (int i = 0; i < size; i++) |
| 589 | { | 589 | { |
| @@ -595,7 +595,7 @@ void LEAF_generate_atodb(float* buffer, int size) · 5 unmodified lines | |||
| 595 | 595 | ||
| 596 | void LEAF_generate_atodbPositiveClipped(float* buffer, float lowerThreshold, float range, int size) | 596 | void LEAF_generate_atodbPositiveClipped(float* buffer, float lowerThreshold, float range, int size) |
| 597 | { | 597 | { |
| 598 | float increment = 1.0f / (float)size; | 598 | float increment = 1.0f / (float)(size-1); |
| 599 | float x = 0.0f; | 599 | float x = 0.0f; |
| 600 | float scalar = range / fastabsf(lowerThreshold); | 600 | float scalar = range / fastabsf(lowerThreshold); |
| 601 | for (int i = 0; i < size; i++) | 601 | for (int i = 0; i < size; i++) |