1a9cf57cfSAxel Dörfler /*
2a9cf57cfSAxel Dörfler * Copyright 2003 Marcus Overhagen
3a9cf57cfSAxel Dörfler * Distributed under the terms of the MIT License.
4575526ffSbeveloper */
549705454SStephan Aßmus #ifndef _RESAMPLER_H
649705454SStephan Aßmus #define _RESAMPLER_H
749705454SStephan Aßmus
8a9cf57cfSAxel Dörfler
949705454SStephan Aßmus #include <SupportDefs.h>
1049705454SStephan Aßmus
11575526ffSbeveloper
12a9cf57cfSAxel Dörfler class Resampler {
13575526ffSbeveloper public:
14a9cf57cfSAxel Dörfler Resampler(uint32 sourceFormat,
15a9cf57cfSAxel Dörfler uint32 destFormat);
16575526ffSbeveloper
17a9cf57cfSAxel Dörfler status_t InitCheck() const;
18575526ffSbeveloper
19a9cf57cfSAxel Dörfler void Resample(const void* src, int32 srcSampleOffset,
20a9cf57cfSAxel Dörfler int32 srcSampleCount, void* dest,
21a9cf57cfSAxel Dörfler int32 destSampleOffset,
22a9cf57cfSAxel Dörfler int32 destSampleCount, float gain);
23575526ffSbeveloper
24575526ffSbeveloper protected:
25*27606daeSAdrien Destugues Resampler();
26*27606daeSAdrien Destugues void (*fFunc)(Resampler* object, const void* src,
27a9cf57cfSAxel Dörfler int32 srcSampleOffset, int32 srcSampleCount,
28a9cf57cfSAxel Dörfler void* dest, int32 destSampleOffset,
29a9cf57cfSAxel Dörfler int32 destSampleCount, float gain);
30575526ffSbeveloper };
31575526ffSbeveloper
32575526ffSbeveloper
33575526ffSbeveloper inline void
Resample(const void * src,int32 srcSampleOffset,int32 srcSampleCount,void * dest,int32 destSampleOffset,int32 destSampleCount,float gain)34a9cf57cfSAxel Dörfler Resampler::Resample(const void *src, int32 srcSampleOffset,
35a9cf57cfSAxel Dörfler int32 srcSampleCount, void *dest, int32 destSampleOffset,
36a9cf57cfSAxel Dörfler int32 destSampleCount, float gain)
37575526ffSbeveloper {
38*27606daeSAdrien Destugues (*fFunc)(this, src, srcSampleOffset, srcSampleCount, dest, destSampleOffset,
39a9cf57cfSAxel Dörfler destSampleCount, gain);
40575526ffSbeveloper }
41575526ffSbeveloper
4249705454SStephan Aßmus #endif // _RESAMPLER_H
43