Fix C++11/14 array initialization (clang < 3.7)

C++11 array initialization won't call copy constructor, leading to
an error: array initializer must be an initializer list.

Specifically this affects the copy c'tor: line 93: peaks (other.peaks)

A workaround is to use a vector instead of a fixed size array.
This fixes macOS builds.
This commit is contained in:
Robin Gareus 2021-12-27 16:30:39 +01:00
parent a71ab327a3
commit 18fe2e2c4e
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -52,6 +52,7 @@ public:
b = std::max<size_t> (100, b);
width = std::max<size_t> (800, width);
peaks.resize (2);
peaks[0].resize (w);
peaks[1].resize (width);
spectrum.resize (width);
@ -135,8 +136,8 @@ public:
uint32_t n_samples;
uint32_t freq[6]; // y-pos, 50, 100, 500, 1k, 5k, 10k [Hz]
std::vector<PeakData> peaks[2];
std::vector<std::vector<float>> spectrum;
std::vector<std::vector<PeakData> > peaks;
std::vector<std::vector<float> > spectrum;
float* lgraph_i;
float* lgraph_s;