summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/k005289.h
blob: 76d6f186610ca87d908e3e6e5d3485f43ccca2f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// license:BSD-3-Clause
// copyright-holders:Bryan McPhail
#ifndef MAME_SOUND_K005289_H
#define MAME_SOUND_K005289_H

#pragma once


// ======================> k005289_device

class k005289_device : public device_t,
						public device_sound_interface
{
public:
	k005289_device(const machine_config &mconfig, const char *tag, device_t *owner, const XTAL &clock);

	void control_A_w(u8 data);
	void control_B_w(u8 data);
	void ld1_w(offs_t offset, u8 data);
	void ld2_w(offs_t offset, u8 data);
	void tg1_w(u8 data);
	void tg2_w(u8 data);

protected:
	// device-level overrides
	virtual void device_start() override;

	// sound stream update overrides
	virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;

private:
	required_region_ptr<u8> m_sound_prom;
	sound_stream *m_stream;

	struct voice_t
	{
		void reset()
		{
			counter = 0;
			frequency = 0;
			pitch = 0;
			waveform = 0;
			volume = 0;
		}

		s16 counter = 0;
		u16 frequency = 0;
		u16 pitch = 0;
		u16 waveform = 0;
		u8 volume = 0;
	};
	voice_t m_voice[2];
};

DECLARE_DEVICE_TYPE(K005289, k005289_device)

#endif // MAME_SOUND_K005289_H