diff options
author | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2008-07-02 12:48:55 +0000 |
---|---|---|
committer | sletz <sletz@0c269be4-1314-0410-8aa9-9f06e86f4224> | 2008-07-02 12:48:55 +0000 |
commit | e6372863fe387ff438865eaaafc142b228f2d031 (patch) | |
tree | ed198883a6cf5ccf199e2ffb8018d994be50f9e5 /common/JackResampler.h | |
parent | c2179552731f4e47ca76472507524c9661006d32 (diff) | |
download | jack2-e6372863fe387ff438865eaaafc142b228f2d031.tar.gz |
New JackLibSampleRateResampler class
git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@2594 0c269be4-1314-0410-8aa9-9f06e86f4224
Diffstat (limited to 'common/JackResampler.h')
-rw-r--r-- | common/JackResampler.h | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/common/JackResampler.h b/common/JackResampler.h index e3fd9b25..7ad8fdc6 100644 --- a/common/JackResampler.h +++ b/common/JackResampler.h @@ -22,45 +22,48 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #include "ringbuffer.h" #include "JackError.h" -#include <samplerate.h> + namespace Jack { - #define DEFAULT_RB_SIZE 16384 + #define DEFAULT_RB_SIZE 16384 * 4 class JackResampler { protected: - SRC_STATE* fResampler; jack_ringbuffer_t* fRingBuffer; - double fRatio; + unsigned int fNum; + unsigned int fDenom; public: JackResampler(); virtual ~JackResampler(); - int ReadResample(float* buffer, unsigned int frames); - int WriteResample(float* buffer, unsigned int frames); + virtual int ReadResample(float* buffer, unsigned int frames); + virtual int WriteResample(float* buffer, unsigned int frames); - int Read(float* buffer, unsigned int frames); - int Write(float* buffer, unsigned int frames); + virtual int Read(float* buffer, unsigned int frames); + virtual int Write(float* buffer, unsigned int frames); - unsigned int ReadSpace(); - unsigned int WriteSpace(); + virtual unsigned int ReadSpace(); + virtual unsigned int WriteSpace(); - void SetRatio(double ratio) + virtual void SetRatio(unsigned int num, unsigned int denom) { - fRatio = ratio; + fNum = num; + fDenom = denom; } - double GetRatio() + virtual void GetRatio(unsigned int& num, unsigned int& denom) { - return fRatio; + num = fNum; + denom = fDenom; } - }; + + }; } #endif |