summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/sound/sp0250.h
blob: 7cb01c97691e312504c4f9c576325a85afaf7211 (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
#pragma once

#ifndef __SP0250_H__
#define __SP0250_H__


struct sp0250_interface {
	void (*m_drq_callback)(device_t *device, int state);
};


class sp0250_device : public device_t,
									public device_sound_interface,
									public sp0250_interface
{
public:
	sp0250_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
	~sp0250_device() {}

	DECLARE_WRITE8_MEMBER( write );
	UINT8 drq_r();
	
protected:
	// device-level overrides
	virtual void device_config_complete();
	virtual void device_start();

	// sound stream update overrides
	virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
	
private:
	// internal state
	INT16 m_amp;
	UINT8 m_pitch;
	UINT8 m_repeat;
	int m_pcount, m_rcount;
	int m_playing;
	UINT32 m_RNG;
	sound_stream * m_stream;
	int m_voiced;
	UINT8 m_fifo[15];
	int m_fifo_pos;
	void (*m_drq)(device_t *device, int state);

	struct
	{
		INT16 F, B;
		INT16 z1, z2;
	} m_filter[6];
	
	void load_values();
	TIMER_CALLBACK_MEMBER( timer_tick );
};

extern const device_type SP0250;


#endif /* __SP0250_H__ */