diff options
Diffstat (limited to 'src/devices/sound/msm5205.cpp')
-rw-r--r-- | src/devices/sound/msm5205.cpp | 50 |
1 files changed, 32 insertions, 18 deletions
diff --git a/src/devices/sound/msm5205.cpp b/src/devices/sound/msm5205.cpp index c44f4760a87..2730ff9e3dd 100644 --- a/src/devices/sound/msm5205.cpp +++ b/src/devices/sound/msm5205.cpp @@ -45,11 +45,12 @@ Master clock frequency 640kHz 384kHz Sampling frequency 4k/8k/16k/32kHz 4k/6k/8kHz ADPCM bit length 4-bit 3-bit/4-bit + Data capture timing 5µsec 15.6µsec DA converter 12-bit 10-bit Low-pass filter -40dB/oct N/A Overflow prevent circuit Included N/A - Data input follows VCK falling edge on MSM5205 (VCK rising edge on MSM6585) + Data capture follows VCK falling edge on MSM5205 (VCK rising edge on MSM6585) TODO: - lowpass filter for MSM6585 @@ -108,7 +109,8 @@ void msm5205_device::device_start() /* stream system initialize */ m_stream = machine().sound().stream_alloc(*this, 0, 1, clock()); - m_timer = timer_alloc(TIMER_VCK); + m_vck_timer = timer_alloc(TIMER_VCK); + m_capture_timer = timer_alloc(TIMER_ADPCM_CAPTURE); /* register for save states */ save_item(NAME(m_data)); @@ -186,13 +188,19 @@ void msm5205_device::compute_tables() void msm5205_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - assert(id == TIMER_VCK); - - m_vck = !m_vck; - m_vck_cb(m_vck); - - if (!m_vck) - update_adpcm(); + switch (id) + { + case TIMER_VCK: + m_vck = !m_vck; + m_vck_cb(m_vck); + if (!m_vck) + m_capture_timer->adjust(attotime::from_nsec(15600)); + break; + + case TIMER_ADPCM_CAPTURE: + update_adpcm(); + break; + } } // timer callback at VCK low edge on MSM5205 (at rising edge on MSM6585) @@ -355,12 +363,12 @@ void msm5205_device::device_clock_changed() logerror("/%d prescaler selected\n", prescaler); attotime half_period = clocks_to_attotime(prescaler / 2); - m_timer->adjust(half_period, 0, half_period); + m_vck_timer->adjust(half_period, 0, half_period); } else { logerror("VCK slave mode selected\n"); - m_timer->adjust(attotime::never); + m_vck_timer->adjust(attotime::never); } } @@ -395,13 +403,19 @@ void msm5205_device::sound_stream_update(sound_stream &stream, stream_sample_t * void msm6585_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - assert(id == TIMER_VCK); - - m_vck = !m_vck; - m_vck_cb(m_vck); - - if (m_vck) - update_adpcm(); + switch (id) + { + case TIMER_VCK: + m_vck = !m_vck; + m_vck_cb(m_vck); + if (m_vck) + m_capture_timer->adjust(attotime::from_usec(3)); + break; + + case TIMER_ADPCM_CAPTURE: + update_adpcm(); + break; + } } |