Revert "CALF: removed usage of non-standard std::vector::data()"

This reverts commit dd260245ec.

The commit fixed the compilation problem but according to upstream
causes new problems because of the huge data structures on the stack.

Upstream provided a better patch which will be applied next.
This commit is contained in:
Tobias Doerffel
2009-10-05 23:44:53 +02:00
parent dd260245ec
commit 68bd237061
2 changed files with 9 additions and 6 deletions

View File

@@ -111,7 +111,9 @@ struct bandlimiter
void make_waveform(float output[SIZE], int cutoff, bool foldover = false)
{
dsp::fft<float, SIZE_BITS> &fft = get_fft();
std::complex<float> new_spec[SIZE], iffted[SIZE];
std::vector<std::complex<float> > new_spec, iffted;
new_spec.resize(SIZE);
iffted.resize(SIZE);
// Copy original harmonics up to cutoff point
new_spec[0] = spectrum[0];
for (int i = 1; i < cutoff; i++)
@@ -144,7 +146,7 @@ struct bandlimiter
new_spec[SIZE - i] = 0.f;
}
// convert back to time domain (IFFT) and extract only real part
fft.calculate(new_spec, iffted, true);
fft.calculate(new_spec.data(), iffted.data(), true);
for (int i = 0; i < SIZE; i++)
output[i] = iffted[i].real();
}

View File

@@ -171,10 +171,11 @@ 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
float tmp[ORGAN_BIG_WAVE_SIZE];
blDest.compute_waveform(tmp);
normalize_waveform(tmp, ORGAN_BIG_WAVE_SIZE);
blDest.compute_spectrum(tmp);
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());
// 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));