Etterna 0.75.1
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#include <vector>
8
10
13{
14 public:
15 /* We own source. */
16 RageSoundReader_Resample_Good(RageSoundReader* pSource, int iSampleRate);
18 int SetPosition(int iFrame) override;
19 int Read(float* pBuf, int iFrames) override;
21 RageSoundReader_Resample_Good* Copy() const override;
22 bool SetProperty(const std::string& sProperty, float fValue) override;
23 int GetNextSourceFrame() const override;
24 float GetStreamToSourceRatio() const override;
25
29 void SetRate(float fRatio);
30
34 float GetRate() const;
35
36 int GetSampleRate() const override { return m_iSampleRate; }
37
38 private:
39 void Reset();
40 void ReopenResampler();
41 void GetFactors(int& iDownFactor, int& iUpFactor) const;
42
43 std::vector<RageSoundResampler_Polyphase*> m_apResamplers; /* one per channel */
44
45 int m_iSampleRate;
46 float m_fRate;
47};
48
49#endif
Definition RageSoundReader_Filter.h:10
This class changes the sampling rate of a sound.
Definition RageSoundReader_Resample_Good.h:13
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