| 1 |
|
| 2 |
|
| 3 |
#ifndef MAME_SOUND_SN76496_H |
| 4 |
#define MAME_SOUND_SN76496_H |
| 5 |
|
| 6 |
#pragma once |
| 7 |
|
| 8 |
|
| 9 |
DECLARE_DEVICE_TYPE(SN76496, sn76496_device) |
| 10 |
DECLARE_DEVICE_TYPE(U8106, u8106_device) |
| 11 |
DECLARE_DEVICE_TYPE(Y2404, y2404_device) |
| 12 |
DECLARE_DEVICE_TYPE(SN76489, sn76489_device) |
| 13 |
DECLARE_DEVICE_TYPE(SN76489A, sn76489a_device) |
| 14 |
DECLARE_DEVICE_TYPE(SN76494, sn76494_device) |
| 15 |
DECLARE_DEVICE_TYPE(SN94624, sn94624_device) |
| 16 |
DECLARE_DEVICE_TYPE(NCR8496, ncr8496_device) |
| 17 |
DECLARE_DEVICE_TYPE(PSSJ3, pssj3_device) |
| 18 |
DECLARE_DEVICE_TYPE(GAMEGEAR, gamegear_device) |
| 19 |
DECLARE_DEVICE_TYPE(SEGAPSG, segapsg_device) |
| 20 |
|
| 21 |
#if 0 |
| 22 |
|
| 23 |
|
| 24 |
#define MCFG_SN76496_READY_HANDLER(cb) \ |
| 25 |
downcast<sn76496_base_device &>(*device).set_ready_handler((DEVCB_##cb)); |
| 26 |
|
| 27 |
#endif |
| 28 |
|
| 29 |
class sn76496_base_device : public device_t, public device_sound_interface |
| 30 |
{ |
| 31 |
public: |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
DECLARE_WRITE8_MEMBER( stereo_w ); |
| 36 |
void write(uint8_t data); |
| 37 |
DECLARE_WRITE8_MEMBER( write ); |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
void convert_samplerate(int32_t target_rate); |
| 42 |
protected: |
| 43 |
sn76496_base_device( |
| 44 |
const machine_config &mconfig, |
| 45 |
device_type type, |
| 46 |
const char *tag, |
| 47 |
int feedbackmask, |
| 48 |
int noisetap1, |
| 49 |
int noisetap2, |
| 50 |
bool negate, |
| 51 |
bool stereo, |
| 52 |
int clockdivider, |
| 53 |
bool ncr, |
| 54 |
bool sega, |
| 55 |
device_t *owner, |
| 56 |
uint32_t clock); |
| 57 |
|
| 58 |
virtual void device_start(); |
| 59 |
virtual void device_clock_changed(); |
| 60 |
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); |
| 61 |
|
| 62 |
private: |
| 63 |
inline bool in_noise_mode(); |
| 64 |
void register_for_save_states(); |
| 65 |
void countdown_cycles(); |
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
bool m_ready_state; |
| 70 |
|
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
const int32_t m_feedback_mask; |
| 76 |
const int32_t m_whitenoise_tap1; |
| 77 |
const int32_t m_whitenoise_tap2; |
| 78 |
const bool m_negate; |
| 79 |
const bool m_stereo; |
| 80 |
const int32_t m_clock_divider; |
| 81 |
const bool m_ncr_style_psg; |
| 82 |
const bool m_sega_style_psg; |
| 83 |
|
| 84 |
int32_t m_vol_table[16]; |
| 85 |
int32_t m_register[8]; |
| 86 |
int32_t m_last_register; |
| 87 |
int32_t m_volume[4]; |
| 88 |
uint32_t m_RNG; |
| 89 |
int32_t m_current_clock; |
| 90 |
int32_t m_stereo_mask; |
| 91 |
int32_t m_period[4]; |
| 92 |
int32_t m_count[4]; |
| 93 |
int32_t m_output[4]; |
| 94 |
int32_t m_cycles_to_ready; |
| 95 |
|
| 96 |
|
| 97 |
int32_t sample_rate; |
| 98 |
|
| 99 |
int32_t rate_add; |
| 100 |
int32_t rate_counter; |
| 101 |
}; |
| 102 |
|
| 103 |
|
| 104 |
class sn76496_device : public sn76496_base_device |
| 105 |
{ |
| 106 |
public: |
| 107 |
sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 108 |
}; |
| 109 |
|
| 110 |
|
| 111 |
class u8106_device : public sn76496_base_device |
| 112 |
{ |
| 113 |
public: |
| 114 |
u8106_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 115 |
}; |
| 116 |
|
| 117 |
|
| 118 |
class y2404_device : public sn76496_base_device |
| 119 |
{ |
| 120 |
public: |
| 121 |
y2404_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 122 |
}; |
| 123 |
|
| 124 |
|
| 125 |
class sn76489_device : public sn76496_base_device |
| 126 |
{ |
| 127 |
public: |
| 128 |
sn76489_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 129 |
}; |
| 130 |
|
| 131 |
|
| 132 |
class pssj3_device : public sn76496_base_device |
| 133 |
{ |
| 134 |
public: |
| 135 |
pssj3_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 136 |
}; |
| 137 |
|
| 138 |
|
| 139 |
|
| 140 |
class sn76489a_device : public sn76496_base_device |
| 141 |
{ |
| 142 |
public: |
| 143 |
sn76489a_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 144 |
}; |
| 145 |
|
| 146 |
|
| 147 |
class sn76494_device : public sn76496_base_device |
| 148 |
{ |
| 149 |
public: |
| 150 |
sn76494_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 151 |
}; |
| 152 |
|
| 153 |
|
| 154 |
class sn94624_device : public sn76496_base_device |
| 155 |
{ |
| 156 |
public: |
| 157 |
sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 158 |
}; |
| 159 |
|
| 160 |
|
| 161 |
class ncr8496_device : public sn76496_base_device |
| 162 |
{ |
| 163 |
public: |
| 164 |
ncr8496_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 165 |
}; |
| 166 |
|
| 167 |
|
| 168 |
class gamegear_device : public sn76496_base_device |
| 169 |
{ |
| 170 |
public: |
| 171 |
gamegear_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 172 |
}; |
| 173 |
|
| 174 |
|
| 175 |
class segapsg_device : public sn76496_base_device |
| 176 |
{ |
| 177 |
public: |
| 178 |
segapsg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); |
| 179 |
}; |
| 180 |
|
| 181 |
#endif |