summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound/k005289.h
blob: 0cadc1182d56a36738289eb693a9e86cede14dc3 (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
58
59
// 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, u32 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 ATTR_COLD;

	// sound stream update overrides
	virtual void sound_stream_update(sound_stream &stream) override;

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

	struct voice_t
	{
		voice_t() { reset(); }

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

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

DECLARE_DEVICE_TYPE(K005289, k005289_device)

#endif // MAME_SOUND_K005289_H