zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit 8071d2c49d86d3545db50b991c22c2a77b6dc851
parent 2631637e5e9a1a2f715b72fe7e9fd31ae8e4424a
Author: Johannes Lorenz <[email protected]>
Date:   Wed, 16 Dec 2020 21:34:14 +0100

OscilGen: No memset on non trivial std::complex<>

This fixes a compiler warning.

Diffstat:
Msrc/Synth/OscilGen.cpp | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/Synth/OscilGen.cpp b/src/Synth/OscilGen.cpp @@ -269,7 +269,8 @@ const rtosc::MergePorts OscilGen::ports{ //operations on FFTfreqs inline void clearAll(fft_t *freqs, int oscilsize) { - memset(freqs, 0, oscilsize / 2 * sizeof(fft_t)); + fft_t zero = 0; + std::fill_n(freqs, oscilsize / 2, zero); } inline void clearDC(fft_t *freqs) @@ -1185,8 +1186,8 @@ void OscilGen::getspectrum(int n, float *spc, int what) if(what == 0) { for(int i = 0; i < n; ++i) outoscilFFTfreqs[i] = fft_t(spc[i], spc[i]); - memset(outoscilFFTfreqs + n, 0, - (synth.oscilsize / 2 - n) * sizeof(fft_t)); + fft_t zero = 0; + std::fill_n(outoscilFFTfreqs + n, synth.oscilsize / 2 - n, zero); adaptiveharmonic(outoscilFFTfreqs, 0.0f); adaptiveharmonicpostprocess(outoscilFFTfreqs, n - 1); for(int i = 0; i < n; ++i)