GetNextSourceFrame, GetStreamToSourceRatio

This commit is contained in:
Glenn Maynard
2006-11-29 21:47:23 +00:00
parent 0bd9c4e032
commit 14c8d02e9e
2 changed files with 19 additions and 0 deletions
@@ -502,6 +502,7 @@ public:
int NumInputsForOutputSamples( int iOut ) const { return m_pPolyphase->NumInputsForOutputSamples(*m_pState, iOut, m_iDownFactor); }
int GetLatency() const { return m_pPolyphase->GetLatency(); }
int GetFilled() const { return m_pState->m_iFilled; }
RageSoundResampler_Polyphase( const RageSoundResampler_Polyphase &cpy )
{
@@ -540,6 +541,22 @@ private:
int m_iDownFactor;
};
int RageSoundReader_Resample_Good::GetNextSourceFrame() const
{
uint64_t iPosition = m_pSource->GetNextSourceFrame();
iPosition -= m_apResamplers[0]->GetFilled();
iPosition *= m_iSampleRate;
iPosition /= m_pSource->GetSampleRate();
return (int) iPosition;
}
float RageSoundReader_Resample_Good::GetStreamToSourceRatio() const
{
float fRatio = m_pSource->GetStreamToSourceRatio();
return fRatio;
}
RageSoundReader_Resample_Good::RageSoundReader_Resample_Good( RageSoundReader *pSource, int iSampleRate )
{
m_pSource = pSource;
@@ -21,6 +21,8 @@ public:
int Read( char *pBuf, unsigned iLen );
virtual ~RageSoundReader_Resample_Good();
RageSoundReader_Resample_Good *Copy() const;
int GetNextSourceFrame() const;
float GetStreamToSourceRatio() const;
int GetSampleRate() const { return m_iSampleRate; }
unsigned GetNumChannels() const { return m_pSource->GetNumChannels(); }