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.
This commit is contained in:
@@ -111,9 +111,7 @@ struct bandlimiter
|
||||
void make_waveform(float output[SIZE], int cutoff, bool foldover = false)
|
||||
{
|
||||
dsp::fft<float, SIZE_BITS> &fft = get_fft();
|
||||
std::vector<std::complex<float> > new_spec, iffted;
|
||||
new_spec.resize(SIZE);
|
||||
iffted.resize(SIZE);
|
||||
std::complex<float> 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();
|
||||
}
|
||||
|
||||
@@ -171,11 +171,10 @@ static void padsynth(bandlimiter<ORGAN_WAVE_BITS> blSrc, bandlimiter<ORGAN_BIG_W
|
||||
blDest.spectrum[ORGAN_BIG_WAVE_SIZE - i] = conj(blDest.spectrum[i]);
|
||||
}
|
||||
// same as above - put large array on heap to avoid stack overflow in ingen
|
||||
vector<float> 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));
|
||||
|
||||
Reference in New Issue
Block a user