diff options
Diffstat (limited to 'src/devices/sound/msm5205.cpp')
-rw-r--r-- | src/devices/sound/msm5205.cpp | 58 |
1 files changed, 11 insertions, 47 deletions
diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp index 9e889503ed9..f3f1f5e6302 100644 --- a/src/devices/sound/msm5205.cpp +++ b/src/devices/sound/msm5205.cpp @@ -91,16 +91,13 @@ msm6585_device::msm6585_device(const machine_config &mconfig, const char *tag, d void msm5205_device::device_start() { - m_vck_cb.resolve_safe(); - m_vck_legacy_cb.resolve(); - /* compute the difference tables */ compute_tables(); /* stream system initialize */ m_stream = stream_alloc(0, 1, clock()); - m_vck_timer = timer_alloc(TIMER_VCK); - m_capture_timer = timer_alloc(TIMER_ADPCM_CAPTURE); + m_vck_timer = timer_alloc(FUNC(msm5205_device::toggle_vck), this); + m_capture_timer = timer_alloc(FUNC(msm5205_device::update_adpcm), this); /* register for save states */ save_item(NAME(m_data)); @@ -172,35 +169,25 @@ void msm5205_device::compute_tables() //------------------------------------------------- -// device_timer - called whenever a device timer -// fires +// toggle_vck - //------------------------------------------------- -void msm5205_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +TIMER_CALLBACK_MEMBER(msm5205_device::toggle_vck) { - switch (id) - { - case TIMER_VCK: - m_vck = !m_vck; - m_vck_cb(m_vck); - if (!m_vck) - m_capture_timer->adjust(attotime::from_hz(clock()/6)); // 15.6 usec at 384KHz - break; - - case TIMER_ADPCM_CAPTURE: - update_adpcm(); - break; - } + m_vck = !m_vck; + m_vck_cb(m_vck); + if (!m_vck) + m_capture_timer->adjust(attotime::from_hz(clock() / adpcm_capture_divisor())); } // timer callback at VCK low edge on MSM5205 (at rising edge on MSM6585) -void msm5205_device::update_adpcm() +TIMER_CALLBACK_MEMBER(msm5205_device::update_adpcm) { int val; int new_signal; // callback user handler and latch next data - if (!m_vck_legacy_cb.isnull()) + if (!m_vck_legacy_cb.isunset()) m_vck_legacy_cb(1); // reset check at last hiedge of VCK @@ -226,7 +213,7 @@ void msm5205_device::update_adpcm() } /* update when signal changed */ - if( m_signal != new_signal) + if (m_signal != new_signal) { m_stream->update(); m_signal = new_signal; @@ -378,29 +365,6 @@ void msm5205_device::sound_stream_update(sound_stream &stream, std::vector<read_ //------------------------------------------------- -// device_timer - called whenever a device timer -// fires -//------------------------------------------------- - -void msm6585_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) -{ - switch (id) - { - case TIMER_VCK: - m_vck = !m_vck; - m_vck_cb(m_vck); - if (m_vck) - m_capture_timer->adjust(attotime::from_hz(clock()/2)); // 3 usec at 640KHz - break; - - case TIMER_ADPCM_CAPTURE: - update_adpcm(); - break; - } -} - - -//------------------------------------------------- // sound_stream_update - handle a stream update //------------------------------------------------- |