Debian Codegraph @

src/engine/platform/sound/ga20/iremga20.h

raw
1 // license:BSD-3-Clause
2 // copyright-holders:Acho A. Tang,R. Belmont
3 /*********************************************************
4
5 Irem GA20 PCM Sound Chip
6
7 DISCLAIMER
8 - This file is modified for suitable in furnace.
9 - modified by cam900 and tildearrow
10
11 *********************************************************/
12 #ifndef MAME_SOUND_IREMGA20_H
13 #define MAME_SOUND_IREMGA20_H
14
15 #pragma once
16
17 //**************************************************************************
18 // TYPE DEFINITIONS
19 //**************************************************************************
20
21 using u8 = unsigned char;
22 using u32 = unsigned int;
23 using s32 = signed int;
24
25 class iremga20_intf
26 {
27 public:
28 virtual u8 read_byte(u32 address) { return 0; };
29 };
30
31 // ======================> iremga20_device
32
33 class iremga20_device
34 {
35 public:
36 iremga20_device(iremga20_intf &intf);
37
38 void write(u32 offset, u8 data);
39 u8 read(u32 offset);
40
41 inline void set_mute(const int ch, const bool mute) { m_channel[ch & 3].mute = mute; m_channel[ch & 3].hot = true; }
42 inline unsigned int get_position(const int ch) {
43 return m_channel[ch&3].pos;
44 }
45 inline bool is_playing(const int ch) {
46 return m_channel[ch&3].play;
47 }
48
49 // device-level overrides
50 void device_reset();
51
52 // sound stream update overrides
53 void sound_stream_update(short* outputs, int len);
54
55
56 struct channel_def
57 {
58 channel_def() :
59 sample(0),
60 rate(0),
61 pos(0),
62 counter(0),
63 end(0),
64 volume(0),
65 output(0),
66 play(0),
67 mute(false),
68 hot(false)
69 {
70 }
71
72 int sample;
73 u32 rate;
74 u32 pos;
75 u32 counter;
76 u32 end;
77 u32 volume;
78 int output;
79 bool play;
80 bool mute;
81 bool hot;
82 };
83
84 u8 m_regs[0x20];
85 channel_def m_channel[4];
86
87 iremga20_intf &m_intf;
88 };
89
90 #endif // MAME_SOUND_IREMGA20_H