openMSX
ResampledSoundDevice.hh
Go to the documentation of this file.
1 #ifndef RESAMPLEDSOUNDDEVICE_HH
2 #define RESAMPLEDSOUNDDEVICE_HH
3 
4 #include "SoundDevice.hh"
5 #include "Observer.hh"
6 #include <memory>
7 
8 namespace openmsx {
9 
10 class MSXMotherBoard;
11 class ResampleAlgo;
12 class Setting;
13 template<typename T> class EnumSetting;
14 
15 class ResampledSoundDevice : public SoundDevice, protected Observer<Setting>
16 {
17 public:
19 
24  bool generateInput(int* buffer, unsigned num);
25 
26 protected:
28  string_ref description, unsigned channels,
29  bool stereo = false);
30  virtual ~ResampledSoundDevice();
31 
32  // SoundDevice
33  virtual void setOutputRate(unsigned sampleRate);
34  virtual bool updateBuffer(unsigned length, int* buffer,
35  EmuTime::param time);
36 
37  // Observer<Setting>
38  virtual void update(const Setting& setting);
39 
40  void createResampler();
41 
42 private:
43  EnumSetting<ResampleType>& resampleSetting;
44  std::unique_ptr<ResampleAlgo> algo;
45 };
46 
47 } // namespace openmsx
48 
49 #endif