Adding more methods for base classes

parent cabd76b0
......@@ -30,7 +30,7 @@ class ITASampleBuffer;
* For equidistant sampling.
*
*/
class IITAVDLInterpolationRoutine
class IITASampleInterpolationRoutine
{
public:
//! Human-readable name
......@@ -70,37 +70,37 @@ public:
};
//! Linear interpolation (fast)
class ITA_BASE_API CITAVDLLinearInterpolation : public IITAVDLInterpolationRoutine
class ITA_BASE_API CITASampleLinearInterpolation : public IITASampleInterpolationRoutine
{
public:
inline CITAVDLLinearInterpolation() {};
inline ~CITAVDLLinearInterpolation() {};
inline CITASampleLinearInterpolation() {};
inline ~CITASampleLinearInterpolation() {};
inline std::string GetName() const { return "Linear Interpolation"; };
inline void GetOverlapSamples( int& iLeft, int& iRight ) const { iLeft = 1; iRight = 0; };
bool Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset = 0 ) const;
};
//! Cubic-Spline interpolation (efficient)
class ITA_BASE_API CITAVDLCubicSplineInterpolation : public IITAVDLInterpolationRoutine
class ITA_BASE_API CITASampleCubicSplineInterpolation : public IITASampleInterpolationRoutine
{
public:
inline CITAVDLCubicSplineInterpolation() {};
inline ~CITAVDLCubicSplineInterpolation() {};
inline CITASampleCubicSplineInterpolation() {};
inline ~CITASampleCubicSplineInterpolation() {};
inline std::string GetName() const { return "Cubic Spline Interpolation"; };
inline void GetOverlapSamples( int& iLeft, int& iRight ) const { iLeft = 2; iRight = 2; };
bool Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset = 0 ) const;
};
//! Windowed Sinc-Interpolation (costly)
class ITA_BASE_API CITAVDLWindowedSincInterpolation : public IITAVDLInterpolationRoutine
class ITA_BASE_API CITASampleWindowedSincInterpolation : public IITASampleInterpolationRoutine
{
public:
inline CITAVDLWindowedSincInterpolation( const int iWindowSize = 13 ) : m_iWindowSize( iWindowSize )
inline CITASampleWindowedSincInterpolation( const int iWindowSize = 13 ) : m_iWindowSize( iWindowSize )
{
m_iWindowSize = m_iWindowSize + m_iWindowSize % 1;
};
inline ~CITAVDLWindowedSincInterpolation() {};
inline ~CITASampleWindowedSincInterpolation() {};
inline std::string GetName() const { return "Windowed Sinc-Interpolation"; };
inline void GetOverlapSamples( int& iLeft, int& iRight ) const { iLeft = m_iWindowSize / 2; iRight = m_iWindowSize / 2; };
bool Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset = 0 ) const;
......
......@@ -332,7 +332,7 @@ public:
std::string toString() const;
//! Werte als Zeichenkette zurckgeben
std::string valuesToString() const;
std::string ValuesToString() const;
//! berblendfunktionen
enum
......
......@@ -63,6 +63,9 @@ public:
//! Get a copy of the values (slow, do not use for read access)
std::vector< float > GetValuesCopy() const;
//! Get values (read-only)
const std::vector< float >& GetValues() const;
//! Scalar multiplication
void Multiply( const float fFactor );
......
......@@ -10,7 +10,7 @@ void spline_cubic_set_equidistant( const int n, const float* y, float* ypp );
// Evaluate cubic spline interpolation point using only base values (y) and second derivatives (ypp) for equidistant data
float spline_cubic_val_equidistant( const int n, const float fX, const float* y, const float* ypp );
bool CITAVDLLinearInterpolation::Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset /*=0*/ ) const
bool CITASampleLinearInterpolation::Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset /*=0*/ ) const
{
assert( pOutput->length() >= iOutputLength + iOutputOffset );
......@@ -138,7 +138,7 @@ bool CITAVDLLinearInterpolation::Interpolate( const ITASampleBuffer* pInput, con
return false;
}
bool CITAVDLCubicSplineInterpolation::Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset /*=0*/ ) const
bool CITASampleCubicSplineInterpolation::Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset /*=0*/ ) const
{
// Eingabe validieren
assert( iInputStartOffset >= 2 );
......@@ -182,7 +182,7 @@ bool CITAVDLCubicSplineInterpolation::Interpolate( const ITASampleBuffer* pInput
return true;
}
bool CITAVDLWindowedSincInterpolation::Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset /*=0*/ ) const
bool CITASampleWindowedSincInterpolation::Interpolate( const ITASampleBuffer* pInput, const int iInputLength, const int iInputStartOffset, ITASampleBuffer* pOutput, const int iOutputLength, const int iOutputOffset /*=0*/ ) const
{
// Eingabe validieren
assert( iInputStartOffset >= m_iWindowSize / 2 );
......
......@@ -9,6 +9,16 @@ CITAMagnitudeSpectrum::CITAMagnitudeSpectrum( const int nNumBands )
SetValueUnit( "dB" );
}
std::vector< float > CITAMagnitudeSpectrum::GetMagnitudesCopy() const
{
return CITASpectrum::GetValuesCopy();
}
const std::vector< float >& CITAMagnitudeSpectrum::GetMagnitudes() const
{
return CITASpectrum::GetValues();
}
void CITAMagnitudeSpectrum::SetMagnitudes( const std::vector< float >& vfMagnitudes )
{
CITASpectrum::SetValues( vfMagnitudes );
......
......@@ -668,3 +668,13 @@ std::string ITASampleBuffer::toString() const
ss << " }";
return ss.str();
}
std::string ITASampleBuffer::ValuesToString() const
{
std::stringstream ss;
ss << "Sample buffer { ";
for( int i = 0; i < m_iLength; i++ )
ss << m_pfData[ i ] << " ";
ss << "}";
return ss.str();
}
......@@ -69,6 +69,11 @@ std::vector< float > CITASpectrum::GetValuesCopy() const
return m_vfValues;
}
const std::vector< float >& CITASpectrum::GetValues() const
{
return m_vfValues;
}
void CITASpectrum::Multiply( const float fFactor )
{
for( size_t n = 0; n < m_vfValues.size(); n++ )
......
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