1 // license:BSD-3-Clause
2 // copyright-holders:Philip Bennett
3 /***************************************************************************
4 
5     Capcom CPS-3 Sound Hardware
6 
7 ****************************************************************************/
8 #ifndef MAME_AUDIO_CPS3_H
9 #define MAME_AUDIO_CPS3_H
10 
11 #pragma once
12 
13 //**************************************************************************
14 //  TYPE DEFINITIONS
15 //**************************************************************************
16 
17 struct cps3_voice
18 {
cps3_voicecps3_voice19 	cps3_voice() :
20 		pos(0),
21 		frac(0)
22 	{
23 		memset(regs, 0, sizeof(uint32_t)*8);
24 	}
25 
26 	uint32_t regs[8];
27 	uint32_t pos;
28 	uint32_t frac;
29 };
30 
31 // ======================> cps3_sound_device
32 
33 class cps3_sound_device : public device_t, public device_sound_interface
34 {
35 public:
36 	cps3_sound_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
~cps3_sound_device()37 	~cps3_sound_device() { }
38 
set_base(int8_t * base)39 	void set_base(int8_t* base) { m_base = base; }
40 
41 	void sound_w(offs_t offset, uint32_t data, uint32_t mem_mask = ~0);
42 	uint32_t sound_r(offs_t offset, uint32_t mem_mask = ~0);
43 
44 protected:
45 	// device-level overrides
46 	virtual void device_start() override;
47 
48 	// sound stream update overrides
49 	virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
50 
51 private:
52 	sound_stream *m_stream;
53 	cps3_voice m_voice[16];
54 	uint16_t     m_key;
55 	int8_t*      m_base;
56 };
57 
58 DECLARE_DEVICE_TYPE(CPS3, cps3_sound_device)
59 
60 #endif // MAME_AUDIO_CPS3_H
61