src/experiments/babybot/soundlocalization/ITDBuffer.cpp
CORR_DATA CITDBuffer::GetWeighedMedia()
{ 
	int i;
	CORR_DATA tmp;
	tmp.itd=0;
	tmp.peak_level=0;
	tmp.valid=0;

	for (i=0;i<m_size;i++ )
	{
		tmp.itd=tmp.itd+pointer[i].itd;
		tmp.peak_level=tmp.peak_level+pointer[i].peak_level;
		tmp.valid=(tmp.valid)||(pointer[i].valid);
	}

	tmp.itd=(tmp.itd)/m_size;
	tmp.peak_level=(tmp.peak_level)/m_size;
	
	return tmp;
}
//--------------------------------------------------------------------------------------
//       Class:  CITDBuffer
//      Method:  GetWeighedMedia()
// Description:  Calculates the weighed mean of the buffer's elements. This has never
// been really working (note from Lorenzo)
//--------------------------------------------------------------------------------------
CITDBuffer
Method:  GetWeighedMedia()
Description:  Calculates the weighed mean of the buffer's elements. This has never
been really working (note from Lorenzo)
CITDBuffer Method : GetWeighedMedia () Description : Calculates the weighed mean of the buffer ' s elements . This has never been really working ( note from Lorenzo )
CORR_DATA CITDBuffer::GetWeighedMedia()
{ 
	int i;
	CORR_DATA tmp;
	tmp.itd=0;
	tmp.peak_level=0;
	tmp.valid=0;
	for (i=0;i<m_size;i++ )
	{
		tmp.itd=tmp.itd+pointer[i].itd;
		tmp.peak_level=tmp.peak_level+pointer[i].peak_level;
		tmp.valid=(tmp.valid)||(pointer[i].valid);
	}
	tmp.itd=(tmp.itd)/m_size;
	tmp.peak_level=(tmp.peak_level)/m_size;
	return tmp;
}
CORR_DATA CITDBuffer :: GetWeighedMedia ( ) { int i ; CORR_DATA tmp ; tmp . itd = 0 ; tmp . peak_level = 0 ; tmp . valid = 0 ; for ( i = 0 ; i < m_size ; i ++ ) { tmp . itd = tmp . itd + pointer [ i ] . itd ; tmp . peak_level = tmp . peak_level + pointer [ i ] . peak_level ; tmp . valid = ( tmp . valid ) || ( pointer [ i ] . valid ) ; } tmp . itd = ( tmp . itd ) / m_size ; tmp . peak_level = ( tmp . peak_level ) / m_size ; return tmp ; }
Class:  CITDBuffer
Method:  GetWeighedMedia()
Description:  Calculates the weighed mean of the buffer's elements.
Class : CITDBuffer Method : GetWeighedMedia () Description : Calculates the weighed mean of the buffer ' s elements .