summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/audio/warpwarp.h
blob: 4f419e8a90e676dc854c428c9bc84cfdd5d98a08 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// license:BSD-3-Clause
// copyright-holders:Allard van der Bas
class geebee_sound_device : public device_t,
									public device_sound_interface
{
public:
	geebee_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);

	enum
	{
		TIMER_VOLUME_DECAY
	};

	DECLARE_WRITE8_MEMBER( sound_w );

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

	// sound stream update overrides
	virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;

	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;

private:
	// internal state
	UINT16 *m_decay;
	sound_stream *m_channel;
	int m_sound_latch;
	int m_sound_signal;
	int m_volume;
	emu_timer *m_volume_timer;
	int m_noise;
	int m_vcount;
};

extern const device_type GEEBEE;




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

	enum
	{
		TIMER_SOUND_VOLUME_DECAY,
		TIMER_MUSIC_VOLUME_DECAY
	};


	DECLARE_WRITE8_MEMBER( sound_w );
	DECLARE_WRITE8_MEMBER( music1_w );
	DECLARE_WRITE8_MEMBER( music2_w );

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

	// sound stream update overrides
	virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;

	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;

private:
	// internal state
	INT16 *m_decay;
	sound_stream *m_channel;
	int m_sound_latch;
	int m_music1_latch;
	int m_music2_latch;
	int m_sound_signal;
	int m_sound_volume;
	emu_timer   *m_sound_volume_timer;
	int m_music_signal;
	int m_music_volume;
	emu_timer   *m_music_volume_timer;
	int m_noise;

	int m_vcarry;
	int m_vcount;
	int m_mcarry;
	int m_mcount;
};

extern const device_type WARPWARP;