Finishing FIR classes

parent b1db2e32
......@@ -57,7 +57,7 @@ public:
*/
CITAFiniteImpulseResponse( const CITAFiniteImpulseResponse& sbSource );
virtual ~CITAFiniteImpulseResponse();
virtual inline ~CITAFiniteImpulseResponse() {};
//! Sampling frequency of FIR filter (double of Nyquist frequency)
double GetSampleRate() const;
......
......@@ -54,7 +54,7 @@ public:
*/
CITAMultichannelFiniteImpulseResponse( const CITAMultichannelFiniteImpulseResponse& sbSource );
virtual ~CITAMultichannelFiniteImpulseResponse();
virtual inline ~CITAMultichannelFiniteImpulseResponse() {};
//! Load from file constructor (audiofile)
/**
......
......@@ -11,12 +11,6 @@ CITAFiniteImpulseResponse::CITAFiniteImpulseResponse( const int iLength, const d
{
}
void CITAFiniteImpulseResponse::Init( const int iLength, const double dSampleRate, const bool bZeroInit /*= true */ )
{
m_dSampleRate = dSampleRate;
ITASampleBuffer::Init( iLength, bZeroInit );
}
CITAFiniteImpulseResponse::CITAFiniteImpulseResponse( const CITAFiniteImpulseResponse* pSource )
{
Init( pSource->GetLength(), pSource->GetSampleRate() );
......@@ -29,6 +23,12 @@ CITAFiniteImpulseResponse::CITAFiniteImpulseResponse( const CITAFiniteImpulseRes
ITASampleBuffer::write( sbSource, sbSource.GetLength() );
}
void CITAFiniteImpulseResponse::Init( const int iLength, const double dSampleRate, const bool bZeroInit /*= true */ )
{
m_dSampleRate = dSampleRate;
ITASampleBuffer::Init( iLength, bZeroInit );
}
double CITAFiniteImpulseResponse::GetSampleRate() const
{
return m_dSampleRate;
......
......@@ -12,17 +12,16 @@ CITAMultichannelFiniteImpulseResponse::CITAMultichannelFiniteImpulseResponse( co
{
}
void CITAMultichannelFiniteImpulseResponse::LoadFromFile( const std::string& sFilePath )
CITAMultichannelFiniteImpulseResponse::CITAMultichannelFiniteImpulseResponse( const CITAMultichannelFiniteImpulseResponse* pSource )
{
ITASampleFrame::Load( sFilePath, m_dSampleRate );
Init( pSource->channels(), pSource->GetLength(), pSource->GetSampleRate() );
ITASampleFrame::write( pSource, pSource->GetLength() );
}
void CITAMultichannelFiniteImpulseResponse::StoreToFile( const std::string& sFilePath ) const
CITAMultichannelFiniteImpulseResponse::CITAMultichannelFiniteImpulseResponse( const CITAMultichannelFiniteImpulseResponse& sbSource )
{
if( GetNumChannels() <= 0 || GetSampleRate() <= 0.0f )
ITA_EXCEPT1( INVALID_PARAMETER, "Trying to store a multichannel FIR filter with no channels or invalid sampling rate" );
ITASampleFrame::Store( sFilePath, GetSampleRate() );
Init( sbSource.GetNumChannels(), sbSource.GetLength(), sbSource.GetSampleRate() );
ITASampleFrame::write( sbSource, sbSource.GetLength() );
}
void CITAMultichannelFiniteImpulseResponse::Init( const int iNumChannels, const int iLength, const double dSampleRate, const bool bZeroInit /*= true */ )
......@@ -31,24 +30,25 @@ void CITAMultichannelFiniteImpulseResponse::Init( const int iNumChannels, const
ITASampleFrame::Init( iNumChannels, iLength, bZeroInit );
}
CITAMultichannelFiniteImpulseResponse::CITAMultichannelFiniteImpulseResponse( const CITAMultichannelFiniteImpulseResponse* pSource )
double CITAMultichannelFiniteImpulseResponse::GetSampleRate() const
{
Init( pSource->channels(), pSource->GetLength(), pSource->GetSampleRate() );
ITASampleFrame::write( pSource, pSource->GetLength() );
return m_dSampleRate;
}
CITAMultichannelFiniteImpulseResponse::CITAMultichannelFiniteImpulseResponse( const CITAMultichannelFiniteImpulseResponse& sbSource )
double CITAMultichannelFiniteImpulseResponse::GetNyquistFrequency() const
{
Init( sbSource.GetNumChannels(), sbSource.GetLength(), sbSource.GetSampleRate() );
ITASampleFrame::write( sbSource, sbSource.GetLength() );
return GetSampleRate() / 2.0f;
}
double CITAMultichannelFiniteImpulseResponse::GetSampleRate() const
void CITAMultichannelFiniteImpulseResponse::LoadFromFile( const std::string& sFilePath )
{
return m_dSampleRate;
ITASampleFrame::Load( sFilePath, m_dSampleRate );
}
double CITAMultichannelFiniteImpulseResponse::GetNyquistFrequency() const
void CITAMultichannelFiniteImpulseResponse::StoreToFile( const std::string& sFilePath ) const
{
return GetSampleRate() / 2.0f;
if( GetNumChannels() <= 0 || GetSampleRate() <= 0.0f )
ITA_EXCEPT1( INVALID_PARAMETER, "Trying to store a multichannel FIR filter with no channels or invalid sampling rate" );
ITASampleFrame::Store( sFilePath, GetSampleRate() );
}
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