forked from mia/Aegisub
Convert audio samples to doubles rather than floats when using FFTW
Originally committed to SVN as r5975.
This commit is contained in:
parent
5d8a802e8a
commit
6ff233b5ac
2 changed files with 4 additions and 4 deletions
|
@ -185,10 +185,10 @@ void AudioSpectrumRenderer::SetResolution(size_t _derivation_size, size_t _deriv
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
void AudioSpectrumRenderer::ConvertToFloat(size_t count, T &dest) {
|
void AudioSpectrumRenderer::ConvertToFloat(size_t count, T *dest) {
|
||||||
for (size_t si = 0; si < count; ++si)
|
for (size_t si = 0; si < count; ++si)
|
||||||
{
|
{
|
||||||
dest[si] = (float)(audio_scratch[si]) / 32768.f;
|
dest[si] = (T)(audio_scratch[si]) / 32768.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,7 +214,7 @@ void AudioSpectrumRenderer::FillBlock(size_t block_index, float *block)
|
||||||
o++;
|
o++;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
ConvertToFloat(2 << derivation_size, fft_scratch);
|
ConvertToFloat(2 << derivation_size, &fft_scratch[0]);
|
||||||
|
|
||||||
float *fft_input = &fft_scratch[0];
|
float *fft_input = &fft_scratch[0];
|
||||||
float *fft_real = &fft_scratch[0] + (2 << derivation_size);
|
float *fft_real = &fft_scratch[0] + (2 << derivation_size);
|
||||||
|
|
|
@ -99,7 +99,7 @@ class AudioSpectrumRenderer : public AudioRendererBitmapProvider {
|
||||||
/// @param count Samples to convert
|
/// @param count Samples to convert
|
||||||
/// @param dest Buffer to fill
|
/// @param dest Buffer to fill
|
||||||
template<class T>
|
template<class T>
|
||||||
void ConvertToFloat(size_t count, T &dest);
|
void ConvertToFloat(size_t count, T *dest);
|
||||||
|
|
||||||
#ifdef WITH_FFTW
|
#ifdef WITH_FFTW
|
||||||
/// FFTW plan data
|
/// FFTW plan data
|
||||||
|
|
Loading…
Reference in a new issue