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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
/* Ricoh RF5C400 emulator */
#pragma once
#ifndef __RF5C400_H__
#define __RF5C400_H__
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
#define MCFG_RF5C400_ADD(_tag, _clock) \
MCFG_DEVICE_ADD(_tag, RF5C400, _clock)
#define MCFG_RF5C400_REPLACE(_tag, _clock) \
MCFG_DEVICE_REPLACE(_tag, RF5C400, _clock)
//**************************************************************************
// TYPE DEFINITIONS
//**************************************************************************
struct rf5c400_channel
{
rf5c400_channel() :
startH(0),
startL(0),
freq(0),
endL(0),
endHloopH(0),
loopL(0),
pan(0),
effect(0),
volume(0),
attack(0),
decay(0),
release(0),
cutoff(0),
pos(0),
step(0),
keyon(0),
env_phase(0),
env_level(0.0),
env_step(0.0),
env_scale(0.0)
{ }
UINT16 startH;
UINT16 startL;
UINT16 freq;
UINT16 endL;
UINT16 endHloopH;
UINT16 loopL;
UINT16 pan;
UINT16 effect;
UINT16 volume;
UINT16 attack;
UINT16 decay;
UINT16 release;
UINT16 cutoff;
UINT64 pos;
UINT64 step;
UINT16 keyon;
UINT8 env_phase;
double env_level;
double env_step;
double env_scale;
};
// ======================> rf5c400_device
class rf5c400_device : public device_t,
public device_sound_interface
{
public:
rf5c400_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
~rf5c400_device() { }
protected:
// device-level overrides
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);
public:
DECLARE_READ16_MEMBER( rf5c400_r );
DECLARE_WRITE16_MEMBER( rf5c400_w );
private:
void rf5c400_init_chip();
UINT8 decode80(UINT8 val);
private:
required_region_ptr<INT16> m_rom;
UINT32 m_rommask;
sound_stream *m_stream;
double m_env_ar_table[0x9f];
double m_env_dr_table[0x9f];
double m_env_rr_table[0x9f];
rf5c400_channel m_channels[32];
};
extern const device_type RF5C400;
#endif /* __RF5C400_H__ */
|