trunk/src/emu/sound/ymz770.c
| r26455 | r26456 | |
| 20 | 20 | |
| 21 | 21 | ymz770_device::ymz770_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 22 | 22 | : device_t(mconfig, YMZ770, "Yamaha YMZ770", tag, owner, clock, "ymz770", __FILE__), |
| 23 | | device_sound_interface(mconfig, *this) |
| 23 | device_sound_interface(mconfig, *this), |
| 24 | m_cur_reg(0), |
| 25 | m_mute(0), |
| 26 | m_doen(0), |
| 27 | m_vlma(0), |
| 28 | m_bsl(0), |
| 29 | m_cpl(0) |
| 24 | 30 | { |
| 25 | 31 | } |
| 26 | 32 | |
| r26455 | r26456 | |
| 45 | 51 | |
| 46 | 52 | // register for save states |
| 47 | 53 | save_item(NAME(m_cur_reg)); |
| 54 | save_item(NAME(m_mute)); |
| 55 | save_item(NAME(m_doen)); |
| 56 | save_item(NAME(m_vlma)); |
| 57 | save_item(NAME(m_bsl)); |
| 58 | save_item(NAME(m_cpl)); |
| 59 | |
| 48 | 60 | for (int i = 0; i < 8; i++) |
| 49 | 61 | { |
| 50 | 62 | save_item(NAME(m_channels[i].phrase), i); |
| r26455 | r26456 | |
| 94 | 106 | void ymz770_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) |
| 95 | 107 | { |
| 96 | 108 | stream_sample_t *outL, *outR; |
| 97 | | int i, ch; |
| 98 | 109 | |
| 99 | 110 | outL = outputs[0]; |
| 100 | 111 | outR = outputs[1]; |
| 101 | 112 | |
| 102 | | for (i = 0; i < samples; i++) |
| 113 | for (int i = 0; i < samples; i++) |
| 103 | 114 | { |
| 104 | | INT32 mix; |
| 115 | INT32 mix = 0; |
| 105 | 116 | |
| 106 | | mix = 0; |
| 107 | | |
| 108 | | for (ch = 0; ch < 8; ch++) |
| 117 | for (int ch = 0; ch < 8; ch++) |
| 109 | 118 | { |
| 110 | 119 | if (m_channels[ch].is_seq_playing) |
| 111 | 120 | { |
| r26455 | r26456 | |
| 212 | 221 | |
| 213 | 222 | void ymz770_device::internal_reg_write(UINT8 reg, UINT8 data) |
| 214 | 223 | { |
| 215 | | if (reg >= 0x40 && reg <= 0x5f) |
| 224 | // global registers |
| 225 | if (reg < 0x40) |
| 216 | 226 | { |
| 227 | switch (reg) |
| 228 | { |
| 229 | case 0x00: |
| 230 | m_mute = data & 1; |
| 231 | m_doen = data >> 1 & 1; |
| 232 | break; |
| 233 | |
| 234 | case 0x01: |
| 235 | m_vlma = data; |
| 236 | break; |
| 237 | |
| 238 | case 0x02: |
| 239 | m_bsl = data & 7; |
| 240 | m_cpl = data >> 4 & 7; |
| 241 | break; |
| 242 | |
| 243 | // unused |
| 244 | default: |
| 245 | break; |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | // playback registers |
| 250 | else if (reg < 0x60) |
| 251 | { |
| 217 | 252 | int voice = reg >> 2 & 0x07; |
| 218 | 253 | |
| 219 | 254 | switch (reg & 0x03) |
| r26455 | r26456 | |
| 250 | 285 | break; |
| 251 | 286 | } |
| 252 | 287 | } |
| 253 | | else if (reg >= 0x80) |
| 288 | |
| 289 | // sequencer registers |
| 290 | else |
| 254 | 291 | { |
| 255 | 292 | int voice = reg >> 4 & 0x07; |
| 256 | 293 | |