From 6ff233b5ac1888e975da5ca163da799d62f79bfc Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Tue, 6 Dec 2011 19:58:54 +0000 Subject: [PATCH] Convert audio samples to doubles rather than floats when using FFTW Originally committed to SVN as r5975. --- aegisub/src/audio_renderer_spectrum.cpp | 6 +++--- aegisub/src/audio_renderer_spectrum.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/aegisub/src/audio_renderer_spectrum.cpp b/aegisub/src/audio_renderer_spectrum.cpp index f2e285a9e..260735a99 100644 --- a/aegisub/src/audio_renderer_spectrum.cpp +++ b/aegisub/src/audio_renderer_spectrum.cpp @@ -185,10 +185,10 @@ void AudioSpectrumRenderer::SetResolution(size_t _derivation_size, size_t _deriv } template -void AudioSpectrumRenderer::ConvertToFloat(size_t count, T &dest) { +void AudioSpectrumRenderer::ConvertToFloat(size_t count, T *dest) { 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++; } #else - ConvertToFloat(2 << derivation_size, fft_scratch); + ConvertToFloat(2 << derivation_size, &fft_scratch[0]); float *fft_input = &fft_scratch[0]; float *fft_real = &fft_scratch[0] + (2 << derivation_size); diff --git a/aegisub/src/audio_renderer_spectrum.h b/aegisub/src/audio_renderer_spectrum.h index 054ca4134..45a7410e9 100644 --- a/aegisub/src/audio_renderer_spectrum.h +++ b/aegisub/src/audio_renderer_spectrum.h @@ -99,7 +99,7 @@ class AudioSpectrumRenderer : public AudioRendererBitmapProvider { /// @param count Samples to convert /// @param dest Buffer to fill template - void ConvertToFloat(size_t count, T &dest); + void ConvertToFloat(size_t count, T *dest); #ifdef WITH_FFTW /// FFTW plan data