src/experiments/babybot/soundlocalization/soundprocessing.cpp
void SoundProcessing::filter(double *input_Re, double *input_Im,
							 double lowFreq, double highFreq)
{
	int i = 0;
	int lowIndex  = int ((lowFreq  / _SamplesPerSec)*numSamples);
	int highIndex = int ((highFreq / _SamplesPerSec)*numSamples);

	ACE_ASSERT(highIndex < numFreqSamples);
	ACE_ASSERT(lowIndex  < highIndex);
	
	//----------------------------------------------------------------------
	//  Setting to cero the frequencies over the highindex
	//----------------------------------------------------------------------
	for ( i = highIndex; i < numFreqSamples - highIndex; i++ )
	{
		input_Re[i] = 0.0;
		input_Im[i] = 0.0;
	}
	// Original code
	/*************************************************************************
	 * nspzbZero(input+highIndex,numFreqSamples-highIndex); 				 *
	 *************************************************************************/
	
	//----------------------------------------------------------------------
	//  Setting to cero the frequencies under the lowIndex
	//  Note: is it sure this is correct???????
	//----------------------------------------------------------------------
#if 0
	if (lowIndex>0)
		for ( i = lowIndex; i < lowIndex; i++)
		{
			input_Re[i] = 0.0;
			input_Im[i] = 0.0;
		}
#endif
	//Original code
	/***************************************
	 * if (lowIndex>0)                     *
	 * nspzbZero(input+lowIndex,lowIndex); *
	 ***************************************/
}
//--------------------------------------------------------------------------------------
//       Class:  SoundProcessing
//      Method:  filter(input, lowFreq, highFreq)
// Description:  filters the spectrum with the low and hight frequencies passed as para
// meters. It is a generic filter. It cuts all the frequencies between the interval
// [lowFreq, highFreq]
// input - pointer to the frequencies vector. The fucntion modifies this input vector
//--------------------------------------------------------------------------------------
SoundProcessing
Method:  filter(input, lowFreq, highFreq)
Description:  filters the spectrum with the low and hight frequencies passed as para
meters. It is a generic filter. It cuts all the frequencies between the interval
[lowFreq, highFreq]
input - pointer to the frequencies vector. The fucntion modifies this input vector
SoundProcessing Method : filter ( input lowFreq highFreq ) Description : filters the spectrum with the low and hight frequencies passed as para meters . It is a generic filter . It cuts all the frequencies between the interval [ lowFreq highFreq ] input - pointer to the frequencies vector . The fucntion modifies this input vector
void SoundProcessing::filter(double *input_Re, double *input_Im,
							 double lowFreq, double highFreq)
{
	int i = 0;
	int lowIndex  = int ((lowFreq  / _SamplesPerSec)*numSamples);
	int highIndex = int ((highFreq / _SamplesPerSec)*numSamples);
	ACE_ASSERT(highIndex < numFreqSamples);
	ACE_ASSERT(lowIndex  < highIndex);
	for ( i = highIndex; i < numFreqSamples - highIndex; i++ )
	{
		input_Re[i] = 0.0;
		input_Im[i] = 0.0;
	}
#if 0
	if (lowIndex>0)
		for ( i = lowIndex; i < lowIndex; i++)
		{
			input_Re[i] = 0.0;
			input_Im[i] = 0.0;
		}
#endif
}
void SoundProcessing :: filter ( double * input_Re , double * input_Im , double lowFreq , double highFreq ) { int i = 0 ; int lowIndex = int ( ( lowFreq / _SamplesPerSec ) * numSamples ) ; int highIndex = int ( ( highFreq / _SamplesPerSec ) * numSamples ) ; ACE_ASSERT ( highIndex < numFreqSamples ) ; ACE_ASSERT ( lowIndex < highIndex ) ; for ( i = highIndex ; i < numFreqSamples - highIndex ; i ++ ) { input_Re [ i ] = 0.0 ; input_Im [ i ] = 0.0 ; } #if 0 if ( lowIndex > 0 ) for ( i = lowIndex ; i < lowIndex ; i ++ ) { input_Re [ i ] = 0.0 ; input_Im [ i ] = 0.0 ; } #endif }
Class:  SoundProcessing
Method:  filter(input, lowFreq, highFreq)
Description:  filters the spectrum with the low and hight frequencies passed as para
meters.
Class : SoundProcessing Method : filter ( input lowFreq highFreq ) Description : filters the spectrum with the low and hight frequencies passed as para meters .
//---------------------------------------------------------------------- //  Setting to cero the frequencies over the highindex //---------------------------------------------------------------------- // Original code /*************************************************************************
	 * nspzbZero(input+highIndex,numFreqSamples-highIndex); 				 *
	 *************************************************************************/ //---------------------------------------------------------------------- //  Setting to cero the frequencies under the lowIndex //  Note: is it sure this is correct??????? //---------------------------------------------------------------------- //Original code /***************************************
	 * if (lowIndex>0)                     *
	 * nspzbZero(input+lowIndex,lowIndex); *
	 ***************************************/