OXYGENHUB
◆ main openmsx / src / sound / YM2413OriginalNukeYKT.hh
1.2 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
/* This is a wrapper around the original (unmodified) NukeYKT code. This is
2
 * only useful for debugging because our modified/optimized NukeYKT code should
3
 * generate identical output.
4
 */
5
#ifndef YM2413ORIGINAL_HPP
6
#define YM2413ORIGINAL_HPP
7
8
#include "YM2413Core.hh"
9
#include "opll.hh"
10
#include <array>
11
12
namespace openmsx::YM2413OriginalNukeYKT {
13
14
class YM2413 final : public YM2413Core
15
{
16
public:
17
	YM2413();
18
	void reset() override;
19
	void writePort(bool port, uint8_t value, int cycle_offset) override;
20
	void pokeReg(uint8_t reg, uint8_t value) override;
21
	[[nodiscard]] std::span<const uint8_t, 64> peekRegs() const override;
22
	void generateChannels(std::span<float*, 9 + 5> out, uint32_t n) override;
23
	[[nodiscard]] float getAmplificationFactor() const override;
24
	void setSpeed(double speed) override;
25
26
	template<typename Archive>
27
	void serialize(Archive& ar, unsigned version);
28
29
private:
30
	opll_t opll;
31
	struct Write {
32
		uint8_t port = uint8_t(-1);
33
		uint8_t value;
34
	};
35
	std::array<Write, 18> writes;
36
37
	// only used for peekReg();
38
	std::array<uint8_t, 64> regs;
39
	uint8_t latch;
40
41
	int allowed_offset = 0;
42
	bool speedUpHack = false;
43
};
44
45
} // namespace openmsx::OriginalNuke
46
47
#endif