From c7f28e72e7e166f679aceebee744e9b8304de046 Mon Sep 17 00:00:00 2001 From: John Glover Date: Sat, 11 Aug 2012 19:58:20 +0100 Subject: [sndobj] Initialise arrays to zero in IFGram.cpp --- src/sndobj/IFGram.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/sndobj/IFGram.cpp b/src/sndobj/IFGram.cpp index 28b0921..2da3ab9 100644 --- a/src/sndobj/IFGram.cpp +++ b/src/sndobj/IFGram.cpp @@ -34,6 +34,11 @@ IFGram::IFGram(){ m_diffsig = new double[m_fftsize]; m_factor = m_sr/TWOPI; m_pdiff = new double[m_halfsize]; + + memset(m_diffwin, 0, sizeof(double) * m_fftsize); + memset(m_fftdiff, 0, sizeof(double) * m_fftsize); + memset(m_diffsig, 0, sizeof(double) * m_fftsize); + memset(m_pdiff, 0, sizeof(double) * m_halfsize); } @@ -45,10 +50,14 @@ IFGram::IFGram(Table* window, SndObj* input, double scale, m_fftdiff = new double[m_fftsize]; m_diffsig = new double[m_fftsize]; m_pdiff = new double[m_halfsize]; - for(int i=0; iLookup(i) - m_table->Lookup(i+1); + } m_factor = m_sr/TWOPI; + memset(m_fftdiff, 0, sizeof(double) * m_fftsize); + memset(m_diffsig, 0, sizeof(double) * m_fftsize); + memset(m_pdiff, 0, sizeof(double) * m_halfsize); } @@ -78,7 +87,6 @@ IFGram::Connect(const char* mess, void* input){ int i; switch(FindMsg(mess)){ - case 24: SetWindow((Table *) input); for(i=0; iLookup(i) - m_table->Lookup(i+1); + } + + memset(m_fftdiff, 0, sizeof(double) * m_fftsize); + memset(m_diffsig, 0, sizeof(double) * m_fftsize); + memset(m_pdiff, 0, sizeof(double) * m_halfsize); } void -- cgit v1.2.3