Applying HDFT spectrum API changes

parent 4c16cfac
......@@ -47,8 +47,8 @@ ITANCTC::ITANCTC( const Config& oNCTCConfig )
t = new ITAHDFTSpectrum( m_oConfig.fSampleRate, iDFTSize, true );
det = new ITAHDFTSpectrum( m_oConfig.fSampleRate, iDFTSize, true );
m_fft.plan( ITAFFT::FFT_R2C, m_oConfig.iCTCFilterLength, m_sfCTC_temp[ 0 ].GetData(), ( *m_vpHRTFs[ 0 ] )[ 0 ]->data() );
m_ifft.plan( ITAFFT::IFFT_C2R, m_oConfig.iCTCFilterLength, ( *m_vpHRTFs[ 0 ] )[ 0 ]->data(), m_sfCTC_temp[ 0 ].GetData() );
m_fft.plan( ITAFFT::FFT_R2C, m_oConfig.iCTCFilterLength, m_sfCTC_temp[ 0 ].GetData(), ( *m_vpHRTFs[ 0 ] )[ 0 ]->GetData() );
m_ifft.plan( ITAFFT::IFFT_C2R, m_oConfig.iCTCFilterLength, ( *m_vpHRTFs[ 0 ] )[ 0 ]->GetData(), m_sfCTC_temp[ 0 ].GetData() );
}
......@@ -183,8 +183,8 @@ void ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter ) con
ITAHDFTSpectra* pHRTF( m_vpHRTFs[ n ] );
// Convert HRIRs to HRTFs
m_fft.execute( m_sfCTC_temp[ 0 ].GetData(), ( *pHRTF )[ 0 ]->data() );
m_fft.execute( m_sfCTC_temp[ 1 ].GetData(), ( *pHRTF )[ 1 ]->data() );
m_fft.execute( m_sfCTC_temp[ 0 ].GetData(), ( *pHRTF )[ 0 ]->GetData() );
m_fft.execute( m_sfCTC_temp[ 1 ].GetData(), ( *pHRTF )[ 1 ]->GetData() );
#ifdef NCTC_EXPORT_FILTER_TO_HARDDRIVE
ITAFFTUtils::Export(pHRTF, "HRIR_LS" + IntToString(n + 1) + "_RAW");
......@@ -222,7 +222,7 @@ void ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter ) con
const float fEnergyLeftChannel = ( *pHRTF )[ 0 ]->getEnergy();
// Apply WICK factor only on magnitudes (left channel)
for( int i = 0; i < ( *pHRTF )[ 0 ]->getSize(); i++ )
for( int i = 0; i < ( *pHRTF )[ 0 ]->GetSize(); i++ )
{
float fMag = ( *pHRTF )[ 0 ]->calcMagnitude( i );
( *pHRTF )[ 0 ]->setMagnitudePreservePhase( i, std::pow( fMag, m_fWaveIncidenceAngleCompensationFactor ) );
......@@ -238,7 +238,7 @@ void ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter ) con
const float fEnergyRightChannel = ( *pHRTF )[ 1 ]->getEnergy();
// Apply WICK factor only on magnitude (right channel)
for( int i = 0; i < ( *pHRTF )[ 1 ]->getSize(); i++ )
for( int i = 0; i < ( *pHRTF )[ 1 ]->GetSize(); i++ )
{
float fMag = ( *pHRTF )[ 1 ]->calcMagnitude( i );
( *pHRTF )[ 1 ]->setMagnitudePreservePhase( i, std::pow( fMag, m_fWaveIncidenceAngleCompensationFactor ) );
......@@ -373,8 +373,8 @@ void ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter ) con
// Time-shift
m_ifft.execute( ( *pCTCFilter )[ 0 ]->data(), m_sfCTC_temp[ 0 ].GetData() );
m_ifft.execute( ( *pCTCFilter )[ 1 ]->data(), m_sfCTC_temp[ 1 ].GetData() );
m_ifft.execute( ( *pCTCFilter )[ 0 ]->GetData(), m_sfCTC_temp[ 0 ].GetData() );
m_ifft.execute( ( *pCTCFilter )[ 1 ]->GetData(), m_sfCTC_temp[ 1 ].GetData() );
// Normalize after IFFT
m_sfCTC_temp.div_scalar( float( m_sfCTC_temp.GetLength() ) );
......@@ -385,8 +385,8 @@ void ITANCTC::CalculateFilter( std::vector< ITAHDFTSpectra* >& vpCTCFilter ) con
iShiftSamples = m_sfCTC_temp.GetLength() / 2; // if invalid, shift by half length
sfTargetData_shift.cyclic_write( m_sfCTC_temp, m_sfCTC_temp.GetLength(), 0, iShiftSamples );
m_fft.execute( sfTargetData_shift[ 0 ].GetData(), ( *pCTCFilter )[ 0 ]->data() );
m_fft.execute( sfTargetData_shift[ 1 ].GetData(), ( *pCTCFilter )[ 1 ]->data() );
m_fft.execute( sfTargetData_shift[ 0 ].GetData(), ( *pCTCFilter )[ 0 ]->GetData() );
m_fft.execute( sfTargetData_shift[ 1 ].GetData(), ( *pCTCFilter )[ 1 ]->GetData() );
#ifdef NCTC_EXPORT_FILTER_TO_HARDDRIVE
ITAFFTUtils::Export(pCTCFilter, "CTCFilter_shift_" + IntToString(n + 1));
......
......@@ -99,7 +99,7 @@ void ITANCTCStreamFilter::ExchangeFilters( const std::vector< ITAHDFTSpectra* >&
// Left binaural signal
ITAUPConvolution* pConvolverL( m_vpConvolvers[iIdxLeft] );
ITAUPFilter* pNewFilterL = m_pFilterPool->RequestFilter();
sbSpectrum.write( oCTCFilterL.data(), sbSpectrum.length() );
sbSpectrum.write( oCTCFilterL.GetData(), sbSpectrum.length() );
fIn = sbSpectrum.data();
fOut = sbImpulseResponse.data();
ifft.execute( fIn, fOut );
......@@ -111,7 +111,7 @@ void ITANCTCStreamFilter::ExchangeFilters( const std::vector< ITAHDFTSpectra* >&
// Right binaural signal
ITAUPConvolution* pConvolverR( m_vpConvolvers[iIdxRight] );
ITAUPFilter* pNewFilterR = m_pFilterPool->RequestFilter();
sbSpectrum.write( oCTCFilterR.data(), sbSpectrum.length() );
sbSpectrum.write( oCTCFilterR.GetData(), sbSpectrum.length() );
fIn = sbSpectrum.data();
fOut = sbImpulseResponse.data();
ifft.execute( fIn, fOut );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment