Etterna 0.74.4
Loading...
Searching...
No Matches
RageSoundReader_Resample_Good.h
1/* RageSoundReader_Resample_Good - fast audio resampling. */
2
3#ifndef RAGE_SOUND_READER_RESAMPLE_GOOD_H
4#define RAGE_SOUND_READER_RESAMPLE_GOOD_H
5
6#include "RageSoundReader_Filter.h"
7
9
12{
13 public:
14 /* We own source. */
15 RageSoundReader_Resample_Good(RageSoundReader* pSource, int iSampleRate);
17 int SetPosition(int iFrame) override;
18 int Read(float* pBuf, int iFrames) override;
20 RageSoundReader_Resample_Good* Copy() const override;
21 bool SetProperty(const std::string& sProperty, float fValue) override;
22 int GetNextSourceFrame() const override;
23 float GetStreamToSourceRatio() const override;
24
28 void SetRate(float fRatio);
29
33 float GetRate() const;
34
35 int GetSampleRate() const override { return m_iSampleRate; }
36
37 private:
38 void Reset();
39 void ReopenResampler();
40 void GetFactors(int& iDownFactor, int& iUpFactor) const;
41
42 std::vector<RageSoundResampler_Polyphase*> m_apResamplers; /* one per channel */
43
44 int m_iSampleRate;
45 float m_fRate;
46};
47
48#endif
Definition RageSoundReader_Filter.h:10
This class changes the sampling rate of a sound.
Definition RageSoundReader_Resample_Good.h:12
float GetRate() const
Retrieve the exact rate.
Definition RageSoundReader_Resample_Good.cpp:784
void SetRate(float fRatio)
Change the rate of a sound without changing the sample rate.
Definition RageSoundReader_Resample_Good.cpp:762
Definition RageSoundReader.h:7
Definition RageSoundReader_Resample_Good.cpp:482