Unified · Split
| @@ -556,7 +556,7 @@ void LEAF_generate_square(float* buffer, float basefreq, int size, LEAF* const l · 555 unmodified lines | ||
| 556 | 556 | //0.001 base gives a good curve that goes from 1 to near zero |
| 557 | 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 | 560 | float x = start; |
| 561 | 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 | 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)); | |
| 572 | − float increment = (end - start) / (float)size; | |
| 573 | − float x = start; | |
| 574 | − float proportion = 0; | |
| 571 | + double skew = log (0.5) / log ((center - start) / (end - start)); | |
| 572 | + double increment = 1.0 / (double)(size-1); | |
| 573 | + double x = 0.0; | |
| 574 | + double proportion = 0.0; | |
| 575 | 575 | for (int i = 0; i < size; i++) |
| 576 | 576 | { |
| 577 | − proportion = expf (logf (x) / skew); | |
| 578 | − buffer[i] = start + (end - start) * proportion; | |
| 577 | + proportion = exp (log(x) / skew); | |
| 578 | + buffer[i] = (float)(start + (end - start) * proportion); | |
| 579 | 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 | 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 | 587 | float x = 0.0f; |
| 588 | 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 | 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 | 599 | float x = 0.0f; |
| 600 | 600 | float scalar = range / fastabsf(lowerThreshold); |
| 601 | 601 | for (int i = 0; i < size; i++) |