From 416bd737074a287ea47106c73ea6bcfde40a75a8 Mon Sep 17 00:00:00 2001 From: John Glover Date: Fri, 24 Jun 2011 18:17:23 +0100 Subject: Change to using distutils. Currently only builds the simplsndobj module --- sndobj/IFGram.cpp | 212 ------------------------------------------------------ 1 file changed, 212 deletions(-) delete mode 100644 sndobj/IFGram.cpp (limited to 'sndobj/IFGram.cpp') diff --git a/sndobj/IFGram.cpp b/sndobj/IFGram.cpp deleted file mode 100644 index fcd73b1..0000000 --- a/sndobj/IFGram.cpp +++ /dev/null @@ -1,212 +0,0 @@ - -//////////////////////////////////////////////////////////////////////// -// This file is part of the SndObj library -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// Copyright (c)Victor Lazzarini, 1997-2004 -// See License.txt for a disclaimer of all warranties -// and licensing information - -///////////////////////////////////////////////// -// IFGram.cpp: Instant Freq Analysis class -// -// Victor Lazzarini, 2003 -///////////////////////////////////////////////// - -#include "IFGram.h" - -IFGram::IFGram(){ - m_diffwin = new double[m_fftsize]; - m_fftdiff = new double[m_fftsize]; - m_diffsig = new double[m_fftsize]; - m_factor = m_sr/TWOPI; - m_pdiff = new double[m_halfsize]; -} - - -IFGram::IFGram(Table* window, SndObj* input, double scale, - int fftsize, int hopsize, double sr) - :PVA(window, input, scale, fftsize, hopsize, sr) -{ - m_diffwin = new double[m_fftsize]; - 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; - -} - - -IFGram::~IFGram(){ - delete[] m_diffwin; - delete[] m_fftdiff; - delete[] m_diffsig; -} - - -int -IFGram::Set(char* mess, double value){ - - switch(FindMsg(mess)){ - - case 22: - SetFFTSize((int) value); - return 1; - - default: - return PVA::Set(mess, value); - - } -} - -int -IFGram::Connect(char* mess, void* input){ - - int i; - - switch(FindMsg(mess)){ - - case 24: - SetWindow((Table *) input); - for(i=0; iLookup(i) - m_table->Lookup(i+1); - return 1; - - default: - return PVA::Connect(mess,input); - - } -} - -void -IFGram::SetFFTSize(int fftsize){ - - FFT::SetFFTSize(fftsize); - - delete[] m_diffwin; - delete[] m_fftdiff; - delete[] m_phases; - - m_factor = m_sr*TWOPI/m_fftsize; - m_diffwin = new double[m_fftsize]; - m_fftdiff = new double[m_fftsize]; - m_phases = new double[m_halfsize]; - - for(int i=0; iLookup(i) - m_table->Lookup(i+1); - -} - -void -IFGram::IFAnalysis(double* signal){ - - double powerspec, da,db, a, b, ph,d; - int i2, i; - - for(i=0; iLookup(i); - } - - double tmp1, tmp2; - for(i=0; i PI) d -= TWOPI; - while(d < -PI) d += TWOPI; - m_phases[i2] += d; - } - else { - m_output[i+1] = i2*m_fund; - m_phases[i2] = 0.f ; - } - } - -} - -short -IFGram::DoProcess(){ - - if(!m_error){ - if(m_input){ - if(m_enable){ - int i; double sig = 0.f; - for(m_vecpos = 0; m_vecpos < m_hopsize; m_vecpos++) { - // signal input - sig = m_input->Output(m_vecpos); - // distribute to the signal input frames - // according to a time pointer (kept by counter[n]) - for(i=0;i < m_frames; i++){ - m_sigframe[i][m_counter[i]]= (double) sig; - m_counter[i]++; - } - } - // every vecsize samples - // set the current fftframe to be transformed - m_cur--; if(m_cur<0) m_cur = m_frames-1; - - // instant frequency analysis - IFAnalysis(m_sigframe[m_cur]); - // zero the current fftframe time pointer - - m_counter[m_cur] = 0; - return 1; - - } else { // if disabled, reset the fftframes - for(m_vecpos =0; m_vecpos < m_hopsize; m_vecpos++) - m_output[m_vecpos] = 0.f; - return 1; - } - - } else { - m_error = 3; - return 0; - } - } - else - return 0; -} -- cgit v1.2.3