openMSX
DACSound16S.hh
Go to the documentation of this file.
1 // This class implements a 16 bit signed DAC
2 
3 #ifndef DACSOUND16S_HH
4 #define DACSOUND16S_HH
5 
6 #include "SoundDevice.hh"
7 #include "BlipBuffer.hh"
8 #include <cstdint>
9 
10 namespace openmsx {
11 
12 class DACSound16S : public SoundDevice
13 {
14 public:
16  const DeviceConfig& config);
17  virtual ~DACSound16S();
18 
19  void reset(EmuTime::param time);
20  void writeDAC(int16_t value, EmuTime::param time);
21 
22  template<typename Archive>
23  void serialize(Archive& ar, unsigned version);
24 
25 private:
26  // SoundDevice
27  void setOutputRate(unsigned sampleRate) override;
28  void generateChannels(int** bufs, unsigned num) override;
29  bool updateBuffer(unsigned length, int* buffer,
30  EmuTime::param time) override;
31 
32  BlipBuffer blip;
33  int16_t lastWrittenValue;
34 };
35 
36 } // namespace openmsx
37 
38 #endif
T length(const vecN< N, T > &x)
Definition: gl_vec.hh:334
void reset(EmuTime::param time)
Definition: DACSound16S.cc:27
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
virtual ~DACSound16S()
Definition: DACSound16S.cc:17
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:15
DACSound16S(string_view name, string_view desc, const DeviceConfig &config)
Definition: DACSound16S.cc:9
void serialize(Archive &ar, unsigned version)
Definition: DACSound16S.cc:61
void writeDAC(int16_t value, EmuTime::param time)
Definition: DACSound16S.cc:32