libsidplayfp  0.3.5
Resampler.h
1 #ifndef RESAMPLER_H
2 #define RESAMPLER_H
3 
4 namespace reSIDfp
5 {
6 
13 class Resampler {
14 
15 protected:
16  virtual int output() const =0;
17 
18  Resampler() {}
19 
20 public:
21  virtual ~Resampler() {}
22 
29  virtual bool input(const int sample)=0;
30 
36  short getOutput() const {
37  const int value = output();
38  // Clip signed integer value into the -32768,32767 range.
39  if ((value+0x8000) & ~0xFFFF)
40  return (value>>31) ^ 0x7FFF;
41  else
42  return value;
43  }
44 
45  virtual void reset()=0;
46 };
47 
48 } // namespace reSIDfp
49 
50 #endif