diff options
Diffstat (limited to 'src/devices/bus/a2bus/a2mcms.cpp')
-rw-r--r-- | src/devices/bus/a2bus/a2mcms.cpp | 48 |
1 files changed, 17 insertions, 31 deletions
diff --git a/src/devices/bus/a2bus/a2mcms.cpp b/src/devices/bus/a2bus/a2mcms.cpp index 7e2cab57b6b..7ccf96376fa 100644 --- a/src/devices/bus/a2bus/a2mcms.cpp +++ b/src/devices/bus/a2bus/a2mcms.cpp @@ -123,7 +123,7 @@ mcms_device *a2bus_mcms1_device::get_engine(void) return m_mcms; } -WRITE_LINE_MEMBER(a2bus_mcms1_device::irq_w) +void a2bus_mcms1_device::irq_w(int state) { if (state == ASSERT_LINE) { @@ -205,10 +205,9 @@ mcms_device::mcms_device(const machine_config &mconfig, const char *tag, device_ void mcms_device::device_start() { - m_write_irq.resolve(); - m_stream = machine().sound().stream_alloc(*this, 0, 2, 31250); - m_timer = timer_alloc(0, nullptr); - m_clrtimer = timer_alloc(1, nullptr); + m_stream = stream_alloc(0, 2, 31250); + m_timer = timer_alloc(FUNC(mcms_device::set_irq_tick), this); + m_clrtimer = timer_alloc(FUNC(mcms_device::clr_irq_tick), this); m_enabled = false; memset(m_vols, 0, sizeof(m_vols)); memset(m_table, 0, sizeof(m_table)); @@ -238,34 +237,28 @@ void mcms_device::device_reset() m_enabled = false; } -void mcms_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) +TIMER_CALLBACK_MEMBER(mcms_device::set_irq_tick) { - if (tid == 0) - { - m_write_irq(ASSERT_LINE); - // clear this IRQ in 10 cycles (?) - m_clrtimer->adjust(attotime::from_usec(10), 0); - } - else if (tid == 1) - { - m_write_irq(CLEAR_LINE); - } + m_write_irq(ASSERT_LINE); + // clear this IRQ in 10 cycles (?) + m_clrtimer->adjust(attotime::from_usec(10), 0); +} + +TIMER_CALLBACK_MEMBER(mcms_device::clr_irq_tick) +{ + m_write_irq(CLEAR_LINE); } -void mcms_device::sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) +void mcms_device::sound_stream_update(sound_stream &stream) { - stream_sample_t *outL, *outR; int i, v; uint16_t wptr; int8_t sample; int32_t mixL, mixR; - outL = outputs[1]; - outR = outputs[0]; - if (m_enabled) { - for (i = 0; i < samples; i++) + for (i = 0; i < stream.samples(); i++) { mixL = mixR = 0; @@ -286,15 +279,8 @@ void mcms_device::sound_stream_update(sound_stream &stream, stream_sample_t **in } } - outL[i] = (mixL * m_mastervol)>>9; - outR[i] = (mixR * m_mastervol)>>9; - } - } - else - { - for (i = 0; i < samples; i++) - { - outL[i] = outR[i] = 0; + stream.put_int(0, i, mixL * m_mastervol, 32768 << 9); + stream.put_int(1, i, mixR * m_mastervol, 32768 << 9); } } } |