openMSX
MSXAudio.hh
Go to the documentation of this file.
1 #ifndef MSXAUDIO_HH
2 #define MSXAUDIO_HH
3 
4 #include "MSXDevice.hh"
5 #include <memory>
6 #include <string>
7 
8 namespace openmsx {
9 
10 class Y8950;
11 class Y8950Periphery;
12 class DACSound8U;
13 
14 class MSXAudio : public MSXDevice
15 {
16 public:
17  explicit MSXAudio(const DeviceConfig& config);
18  virtual ~MSXAudio();
19 
23  Y8950Periphery& createPeriphery(const std::string& soundDeviceName);
24 
25  virtual void powerUp(EmuTime::param time);
26  virtual void reset(EmuTime::param time);
27  virtual byte readIO(word port, EmuTime::param time);
28  virtual byte peekIO(word port, EmuTime::param time) const;
29  virtual void writeIO(word port, byte value, EmuTime::param time);
30  virtual byte readMem(word address, EmuTime::param time);
31  virtual byte peekMem(word address, EmuTime::param time) const;
32  virtual void writeMem(word address, byte value, EmuTime::param time);
33  virtual const byte* getReadCacheLine(word start) const;
34  virtual byte* getWriteCacheLine(word start) const;
35 
36  template<typename Archive>
37  void serialize(Archive& ar, unsigned version);
38 
39 private:
40  void enableDAC(bool enable, EmuTime::param time);
41 
42  std::unique_ptr<Y8950Periphery> periphery;
43  std::unique_ptr<Y8950> y8950;
44  std::unique_ptr<DACSound8U> dac;
45  int registerLatch;
46  byte dacValue;
47  bool dacEnabled;
48 
49  friend class MusicModulePeriphery;
51  friend class ToshibaAudioPeriphery;
52 };
53 
54 } // namespace openmsx
55 
56 #endif