OXYGENHUB
◆ main openmsx / src / sound / MSXTurboRPCM.hh
1000 B · C++ · last changed chore(): initial commit 1 month ago source blame history raw
e8555c89 Andy McCall 1
#ifndef MSXTURBORPCM_HH
2
#define MSXTURBORPCM_HH
3
4
#include "AudioInputConnector.hh"
5
#include "DACSound8U.hh"
6
7
#include "Clock.hh"
8
#include "MSXDevice.hh"
9
10
namespace openmsx {
11
12
class MSXMixer;
13
14
class MSXTurboRPCM final : public MSXDevice
15
{
16
public:
17
	explicit MSXTurboRPCM(const DeviceConfig& config);
18
	~MSXTurboRPCM() override;
19
20
	void reset(EmuTime time) override;
21
	[[nodiscard]] byte readIO(uint16_t port, EmuTime time) override;
22
	[[nodiscard]] byte peekIO(uint16_t port, EmuTime time) const override;
23
	void writeIO(uint16_t port, byte value, EmuTime time) override;
24
25
	template<typename Archive>
26
	void serialize(Archive& ar, unsigned version);
27
28
private:
29
	[[nodiscard]] byte getSample(EmuTime time) const;
30
	[[nodiscard]] bool getComp(EmuTime time) const;
31
	void hardwareMute(bool mute);
32
33
private:
34
	MSXMixer& mixer;
35
	AudioInputConnector connector;
36
	DACSound8U dac;
37
	Clock<3579545, 228> reference; // 15700Hz
38
	byte DValue;
39
	byte status;
40
	byte hold;
41
	bool hwMute = false;
42
};
43
44
} // namespace openmsx
45
46
#endif