diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2018-01-20 17:46:13 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2018-01-20 17:46:13 -0500 |
commit | fef11b90870b786ce0fe01d75d59e200525dde96 (patch) | |
tree | b7597215937733803dcb6a7477ba2a1b64fb9543 | |
parent | 8d540d5f9c186f2dd58422b53d760cee50ff718b (diff) |
Fix timeplt_audio (nw)
-rw-r--r-- | src/mame/audio/timeplt.cpp | 29 | ||||
-rw-r--r-- | src/mame/audio/timeplt.h | 14 |
2 files changed, 17 insertions, 26 deletions
diff --git a/src/mame/audio/timeplt.cpp b/src/mame/audio/timeplt.cpp index 8199f02b418..d240998c957 100644 --- a/src/mame/audio/timeplt.cpp +++ b/src/mame/audio/timeplt.cpp @@ -28,6 +28,9 @@ DEFINE_DEVICE_TYPE(TIMEPLT_AUDIO, timeplt_audio_device, "timplt_audio", "Time Pi timeplt_audio_device::timeplt_audio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TIMEPLT_AUDIO, tag, owner, clock) , device_sound_interface(mconfig, *this) + , m_soundcpu(*this, "tpsound") + , m_filter_0(*this, "filter.0.%u", 0) + , m_filter_1(*this, "filter.1.%u", 0) , m_last_irq_state(0) { } @@ -38,14 +41,6 @@ timeplt_audio_device::timeplt_audio_device(const machine_config &mconfig, const void timeplt_audio_device::device_start() { - m_soundcpu = machine().device<cpu_device>("tpsound"); - m_filter_0_0 = machine().device("filter.0.0"); - m_filter_0_1 = machine().device("filter.0.1"); - m_filter_0_2 = machine().device("filter.0.2"); - m_filter_1_0 = machine().device("filter.1.0"); - m_filter_1_1 = machine().device("filter.1.1"); - m_filter_1_2 = machine().device("filter.1.2"); - m_last_irq_state = 0; save_item(NAME(m_last_irq_state)); } @@ -92,7 +87,7 @@ READ8_MEMBER( timeplt_audio_device::portB_r ) * *************************************/ -void timeplt_audio_device::filter_w( device_t *device, int data ) +void timeplt_audio_device::filter_w(filter_rc_device &device, int data) { int C = 0; @@ -101,18 +96,18 @@ void timeplt_audio_device::filter_w( device_t *device, int data ) if (data & 2) C += 47000; /* 47000pF = 0.047uF */ - downcast<filter_rc_device*>(device)->filter_rc_set_RC(filter_rc_device::LOWPASS, 1000, 5100, 0, CAP_P(C)); + device.filter_rc_set_RC(filter_rc_device::LOWPASS, 1000, 5100, 0, CAP_P(C)); } WRITE8_MEMBER( timeplt_audio_device::filter_w ) { - filter_w(m_filter_1_0, (offset >> 0) & 3); - filter_w(m_filter_1_1, (offset >> 2) & 3); - filter_w(m_filter_1_2, (offset >> 4) & 3); - filter_w(m_filter_0_0, (offset >> 6) & 3); - filter_w(m_filter_0_1, (offset >> 8) & 3); - filter_w(m_filter_0_2, (offset >> 10) & 3); + filter_w(*m_filter_1[0], (offset >> 0) & 3); + filter_w(*m_filter_1[1], (offset >> 2) & 3); + filter_w(*m_filter_1[2], (offset >> 4) & 3); + filter_w(*m_filter_0[0], (offset >> 6) & 3); + filter_w(*m_filter_0[1], (offset >> 8) & 3); + filter_w(*m_filter_0[2], (offset >> 10) & 3); } @@ -188,7 +183,7 @@ MACHINE_CONFIG_START(timeplt_audio_device::timeplt_sound) MCFG_SOUND_ADD("ay1", AY8910, MASTER_CLOCK/8) MCFG_AY8910_PORT_A_READ_CB(DEVREAD8("^soundlatch", generic_latch_8_device, read)) - MCFG_AY8910_PORT_B_READ_CB(DEVREAD8("timeplt_audio", timeplt_audio_device, portB_r)) + MCFG_AY8910_PORT_B_READ_CB(READ8(timeplt_audio_device, portB_r)) MCFG_SOUND_ROUTE(0, "filter.0.0", 0.60) MCFG_SOUND_ROUTE(1, "filter.0.1", 0.60) MCFG_SOUND_ROUTE(2, "filter.0.2", 0.60) diff --git a/src/mame/audio/timeplt.h b/src/mame/audio/timeplt.h index 3ea327338d4..3097d9e5c95 100644 --- a/src/mame/audio/timeplt.h +++ b/src/mame/audio/timeplt.h @@ -31,17 +31,13 @@ protected: private: // internal state - uint8_t m_last_irq_state; - cpu_device *m_soundcpu; + required_device<cpu_device> m_soundcpu; + required_device_array<filter_rc_device, 3> m_filter_0; + required_device_array<filter_rc_device, 3> m_filter_1; - device_t *m_filter_0_0; - device_t *m_filter_0_1; - device_t *m_filter_0_2; - device_t *m_filter_1_0; - device_t *m_filter_1_1; - device_t *m_filter_1_2; + uint8_t m_last_irq_state; - void filter_w( device_t *device, int data ); + void filter_w(filter_rc_device &device, int data); }; DECLARE_DEVICE_TYPE(TIMEPLT_AUDIO, timeplt_audio_device) |