Skip to content

Commit a7f5bce

Browse files
committed
Optimized noise generation algorithm by using LSP DSP library
1 parent 05d2c9e commit a7f5bce

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
=== 1.0.33 ===
66
* Spectral Processor now allows to analyze input signal without processing.
7+
* Optimized noise generation algorithm by using LSP DSP library.
78

89
=== 1.0.32 ===
910
* Fixes in 3D object loading.

src/main/misc/envelope.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,12 @@ namespace lsp
4040

4141
static inline void basic_noise(float *dst, size_t n, float k)
4242
{
43-
if (n <= 0)
43+
if (n == 0)
4444
return;
4545

46-
dst[0] = 1.0f;
47-
if (n <= 1)
48-
return;
49-
50-
++dst;
51-
--n;
52-
5346
dsp::lramp_set1(dst, 0.0f, FREQ_RANGE, n);
54-
dsp::powcv1(dst, k, n);
47+
dst[0] = 0.0f;
48+
dsp::powvc1(&dst[1], k, n-1);
5549
}
5650

5751
LSP_DSP_UNITS_PUBLIC

0 commit comments

Comments
 (0)