Refactoring audio sample 'rate' conversion for special load method

parent 562c5ee1
......@@ -91,10 +91,10 @@ public:
void Load( const std::string& sFilePath );
//! Load audio sample from file and convert sample rate, if necessary
void LoadWithSampleTypeConversion( const std::string& sFilePath );
void LoadWithSampleRateConversion( const std::string& sFilePath );
//! Load audio sample from file and convert sample rate, if necessary
void LoadWithSampleTypeConversion( const CITAAudioSample& asSource );
void LoadWithSampleRateConversion( const CITAAudioSample& asSource );
private:
......
......@@ -39,7 +39,7 @@ void CITAAudioSample::Init( const int iNumChannels, const int iLength, const flo
ITASampleFrame::Init( iNumChannels, iLength, bZeroInit );
}
void CITAAudioSample::LoadWithSampleTypeConversion( const std::string& sFilePath )
void CITAAudioSample::LoadWithSampleRateConversion( const std::string& sFilePath )
{
if( m_fSampleRate <= 0.0f )
ITA_EXCEPT_INVALID_PARAMETER( "Invalid internal audio sample sampling rate" );
......@@ -52,7 +52,7 @@ void CITAAudioSample::LoadWithSampleTypeConversion( const std::string& sFilePath
Load( sfRaw, GetSampleRate() );
}
void CITAAudioSample::LoadWithSampleTypeConversion( const CITAAudioSample& asSource )
void CITAAudioSample::LoadWithSampleRateConversion( const CITAAudioSample& asSource )
{
ITASampleFrame* psfSource = ( ITASampleFrame* ) &asSource;
Load( *psfSource, asSource.GetSampleRate() );
......
......@@ -11,7 +11,7 @@ int main( int, char** )
{
CITAAudioSample asTTS48kHz( "tts.wav" );
CITAAudioSample asTTS44kHz;
asTTS44kHz.LoadWithSampleTypeConversion( asTTS48kHz );
asTTS44kHz.LoadWithSampleRateConversion( asTTS48kHz );
asTTS44kHz.Store( "tts_44khz.wav" );
cout << "Converted files." << endl;
......@@ -32,9 +32,9 @@ int main( int, char** )
as44kfs[ 0 ][ 0 ] = 1.0f;
as44kfs[ 0 ][ as44kfs.GetLength() - 1 ] = -1.0f;
as48kfs.LoadWithSampleTypeConversion( as44kfs );
as96kfs.LoadWithSampleTypeConversion( as48kfs );
as128kfs.LoadWithSampleTypeConversion( as96kfs );
as48kfs.LoadWithSampleRateConversion( as44kfs );
as96kfs.LoadWithSampleRateConversion( as48kfs );
as128kfs.LoadWithSampleRateConversion( as96kfs );
cout << "Converted." << endl;
}
......
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