make RageSoundReader_Resample_Good a RageSoundReader_Filter
This commit is contained in:
@@ -594,9 +594,9 @@ float RageSoundReader_Resample_Good::GetStreamToSourceRatio() const
|
||||
return fRatio;
|
||||
}
|
||||
|
||||
RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( RageSoundReader *pSource, int iSampleRate )
|
||||
RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( RageSoundReader *pSource, int iSampleRate ):
|
||||
RageSoundReader_Filter( pSource )
|
||||
{
|
||||
m_pSource = pSource;
|
||||
m_iSampleRate = iSampleRate;
|
||||
m_fRate = -1;
|
||||
ReopenResampler();
|
||||
@@ -661,17 +661,6 @@ RageSoundReader_Resample_Good::~RageSoundReader_Resample_Good()
|
||||
{
|
||||
for( size_t iChannel = 0; iChannel < m_apResamplers.size(); ++iChannel )
|
||||
delete m_apResamplers[iChannel];
|
||||
delete m_pSource;
|
||||
}
|
||||
|
||||
int RageSoundReader_Resample_Good::GetLength() const
|
||||
{
|
||||
return m_pSource->GetLength();
|
||||
}
|
||||
|
||||
int RageSoundReader_Resample_Good::GetLength_Fast() const
|
||||
{
|
||||
return m_pSource->GetLength_Fast();
|
||||
}
|
||||
|
||||
/* iFrame is in the destination rate. Seek the source in its own sample rate. */
|
||||
@@ -790,11 +779,10 @@ void RageSoundReader_Resample_Good::SetRate( float fRatio )
|
||||
}
|
||||
|
||||
RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( const RageSoundReader_Resample_Good &cpy ):
|
||||
RageSoundReader(cpy)
|
||||
RageSoundReader_Filter(cpy)
|
||||
{
|
||||
for( size_t i = 0; i < cpy.m_apResamplers.size(); ++i )
|
||||
this->m_apResamplers.push_back( new RageSoundResampler_Polyphase(*cpy.m_apResamplers[i]) );
|
||||
this->m_pSource = cpy.m_pSource->Copy();
|
||||
this->m_iSampleRate = cpy.m_iSampleRate;
|
||||
this->m_fRate = cpy.m_fRate;
|
||||
}
|
||||
|
||||
@@ -3,19 +3,17 @@
|
||||
#ifndef RAGE_SOUND_READER_RESAMPLE_GOOD_H
|
||||
#define RAGE_SOUND_READER_RESAMPLE_GOOD_H
|
||||
|
||||
#include "RageSoundReader.h"
|
||||
#include "RageSoundReader_Filter.h"
|
||||
|
||||
class RageSoundResampler_Polyphase;
|
||||
|
||||
/* This class changes the sampling rate of a sound. */
|
||||
class RageSoundReader_Resample_Good: public RageSoundReader
|
||||
class RageSoundReader_Resample_Good: public RageSoundReader_Filter
|
||||
{
|
||||
public:
|
||||
/* We own source. */
|
||||
RageSoundReader_Resample_Good( RageSoundReader *pSource, int iSampleRate );
|
||||
RageSoundReader_Resample_Good( const RageSoundReader_Resample_Good &cpy );
|
||||
int GetLength() const;
|
||||
int GetLength_Fast() const;
|
||||
int SetPosition( int iFrame );
|
||||
int Read( char *pBuf, int iFrames );
|
||||
virtual ~RageSoundReader_Resample_Good();
|
||||
@@ -23,14 +21,11 @@ public:
|
||||
bool SetProperty( const RString &sProperty, float fValue );
|
||||
int GetNextSourceFrame() const;
|
||||
float GetStreamToSourceRatio() const;
|
||||
RageSoundReader *GetSource() { return m_pSource; }
|
||||
|
||||
/* Change the rate of a sound without changing the sample rate. */
|
||||
void SetRate( float fRatio );
|
||||
|
||||
int GetSampleRate() const { return m_iSampleRate; }
|
||||
unsigned GetNumChannels() const { return m_pSource->GetNumChannels(); }
|
||||
bool IsStreamingFromDisk() const { return m_pSource->IsStreamingFromDisk(); }
|
||||
|
||||
private:
|
||||
void Reset();
|
||||
@@ -39,7 +34,6 @@ private:
|
||||
|
||||
vector<RageSoundResampler_Polyphase *> m_apResamplers; /* one per channel */
|
||||
|
||||
RageSoundReader *m_pSource;
|
||||
int m_iSampleRate;
|
||||
float m_fRate;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user