From ab814c03a7206a2d701e02c029dc2912ffc1464e Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 24 Dec 2010 00:30:27 +0100 Subject: [PATCH] SpectrumAnalyzer: fixed multiple instantiations When instantiating the SpectrumAnalyzer plugin more than once the processed data somehow got invalid and caused all but the first SpectrumAnalyzer instance not to work at all. This can be fixed easily by clearing m_buffer in SpectrumAnalyzer's constructor. Closes #3137877. --- plugins/spectrum_analyzer/spectrum_analyzer.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/spectrum_analyzer/spectrum_analyzer.cpp b/plugins/spectrum_analyzer/spectrum_analyzer.cpp index 5ce6c067f..16d27fe94 100644 --- a/plugins/spectrum_analyzer/spectrum_analyzer.cpp +++ b/plugins/spectrum_analyzer/spectrum_analyzer.cpp @@ -56,6 +56,8 @@ spectrumAnalyzer::spectrumAnalyzer( Model * _parent, m_framesFilledUp( 0 ), m_energy( 0 ) { + memset( m_buffer, 0, sizeof( m_buffer ) ); + m_specBuf = (fftwf_complex *) fftwf_malloc( ( FFT_BUFFER_SIZE + 1 ) * sizeof( fftwf_complex ) ); m_fftPlan = fftwf_plan_dft_r2c_1d( FFT_BUFFER_SIZE*2, m_buffer,