From dd260245ec2d10d32a77ca2464490445f8fb858e Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sat, 3 Oct 2009 01:12:56 +0200 Subject: [PATCH] CALF: removed usage of non-standard std::vector::data() The std::vector::data() method is a special feature of GCC and therefore not portable. This causes a compile failure of CALF plugin on OS X. Therefore I replaced the code with standard arrays allocated on stack. Upstream needs to be informed about this patch. Thanks to Daniel Klaffenbach for pointing out this issue. --- plugins/ladspa_effect/calf/calf/osc.h | 6 ++---- plugins/ladspa_effect/calf/src/organ.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/plugins/ladspa_effect/calf/calf/osc.h b/plugins/ladspa_effect/calf/calf/osc.h index 36c19fe3c..0d75c575a 100644 --- a/plugins/ladspa_effect/calf/calf/osc.h +++ b/plugins/ladspa_effect/calf/calf/osc.h @@ -111,9 +111,7 @@ struct bandlimiter void make_waveform(float output[SIZE], int cutoff, bool foldover = false) { dsp::fft &fft = get_fft(); - std::vector > new_spec, iffted; - new_spec.resize(SIZE); - iffted.resize(SIZE); + std::complex new_spec[SIZE], iffted[SIZE]; // Copy original harmonics up to cutoff point new_spec[0] = spectrum[0]; for (int i = 1; i < cutoff; i++) @@ -146,7 +144,7 @@ struct bandlimiter new_spec[SIZE - i] = 0.f; } // convert back to time domain (IFFT) and extract only real part - fft.calculate(new_spec.data(), iffted.data(), true); + fft.calculate(new_spec, iffted, true); for (int i = 0; i < SIZE; i++) output[i] = iffted[i].real(); } diff --git a/plugins/ladspa_effect/calf/src/organ.cpp b/plugins/ladspa_effect/calf/src/organ.cpp index 661b73b15..18373c89d 100644 --- a/plugins/ladspa_effect/calf/src/organ.cpp +++ b/plugins/ladspa_effect/calf/src/organ.cpp @@ -171,11 +171,10 @@ static void padsynth(bandlimiter blSrc, bandlimiter tmp; - tmp.resize(ORGAN_BIG_WAVE_SIZE); - blDest.compute_waveform(tmp.data()); - normalize_waveform(tmp.data(), ORGAN_BIG_WAVE_SIZE); - blDest.compute_spectrum(tmp.data()); + float tmp[ORGAN_BIG_WAVE_SIZE]; + blDest.compute_waveform(tmp); + normalize_waveform(tmp, ORGAN_BIG_WAVE_SIZE); + blDest.compute_spectrum(tmp); // limit is 1/2 of the number of harmonics of the original wave result.make_from_spectrum(blDest, foldover, ORGAN_WAVE_SIZE >> (1 + ORGAN_BIG_WAVE_SHIFT));