From b3c35fa4bcf0db2855380f93240360a1e9656242 Mon Sep 17 00:00:00 2001 From: Ivan Vangelista Date: Wed, 19 Mar 2014 12:26:41 +0000 Subject: [PATCH] votrax_sc01_device: converted to devcb2 (nw) --- src/emu/sound/votrax.c | 25 ++++++------------------- src/emu/sound/votrax.h | 23 ++++++----------------- src/mame/audio/gottlieb.c | 13 ++----------- src/mess/drivers/votrpss.c | 6 +----- src/mess/drivers/votrtnt.c | 7 ++----- 5 files changed, 17 insertions(+), 57 deletions(-) diff --git a/src/emu/sound/votrax.c b/src/emu/sound/votrax.c index 90b4674a603..0c1c9c2d34b 100644 --- a/src/emu/sound/votrax.c +++ b/src/emu/sound/votrax.c @@ -98,24 +98,11 @@ votrax_sc01_device::votrax_sc01_device(const machine_config &mconfig, const char : device_t(mconfig, VOTRAX_SC01, "Votrax SC-01", tag, owner, clock, "votrax", __FILE__), device_sound_interface(mconfig, *this), m_stream(NULL), - m_phoneme_timer(NULL) + m_phoneme_timer(NULL), + m_request_cb(*this) { } - -//------------------------------------------------- -// static_set_interface - configuration helper -// to set the interface -//------------------------------------------------- - -void votrax_sc01_device::static_set_interface(device_t &device, const votrax_sc01_interface &interface) -{ - votrax_sc01_device &votrax = downcast(device); - static_cast(votrax) = interface; -} - - - //************************************************************************** // READ/WRITE HANDLERS //************************************************************************** @@ -144,7 +131,7 @@ mame_printf_debug("%s: STROBE %s (F1=%X F2=%X FC=%X F3=%X F2Q=%X VA=%X FA=%X CL= m_latch_92 = 0; // clear the request signal - m_request_func(m_request_state = m_internal_request = CLEAR_LINE); + m_request_cb(m_request_state = m_internal_request = CLEAR_LINE); m_phoneme_timer->adjust(attotime::zero); } @@ -1145,7 +1132,7 @@ void votrax_sc01_device::device_start() m_phoneme = 0x3f; // reset outputs - m_request_func.resolve(m_request_cb, *this); + m_request_cb.resolve_safe(); m_request_state = ASSERT_LINE; m_internal_request = ASSERT_LINE; @@ -1237,7 +1224,7 @@ void votrax_sc01_device::device_reset() // reset inputs m_phoneme = 0x3f; - m_request_func(m_internal_request = m_request_state = ASSERT_LINE); + m_request_cb(m_internal_request = m_request_state = ASSERT_LINE); // reset timing circuit m_master_clock = 0; @@ -1356,7 +1343,7 @@ void votrax_sc01_device::device_timer(emu_timer &timer, device_timer_id id, int if (m_internal_request == ASSERT_LINE) { mame_printf_debug("%s: REQUEST\n", timer.machine().time().as_string(3)); - m_request_func(m_request_state = ASSERT_LINE); + m_request_cb(m_request_state = ASSERT_LINE); return; } diff --git a/src/emu/sound/votrax.h b/src/emu/sound/votrax.h index 8d099fb0c6c..85acea086d2 100644 --- a/src/emu/sound/votrax.h +++ b/src/emu/sound/votrax.h @@ -20,36 +20,25 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_VOTRAX_SC01_ADD(_tag, _clock, _interface) \ - MCFG_DEVICE_ADD(_tag, VOTRAX_SC01, _clock) \ - votrax_sc01_device::static_set_interface(*device, _interface); +#define MCFG_VOTRAX_SC01_REQUEST_CB(_devcb) \ + devcb = &votrax_sc01_device::set_request_callback(*device, DEVCB2_##_devcb); //************************************************************************** // TYPE DEFINITIONS //************************************************************************** -// ======================> votrax_sc01_interface - -struct votrax_sc01_interface -{ - devcb_write_line m_request_cb; // callback for request -}; - - // ======================> votrax_sc01_device class votrax_sc01_device : public device_t, - public device_sound_interface, - public votrax_sc01_interface + public device_sound_interface { public: // construction/destruction votrax_sc01_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - // static configuration helpers - static void static_set_interface(device_t &device, const votrax_sc01_interface &interface); - + template static devcb2_base &set_request_callback(device_t &device, _Object object) { return downcast(device).m_request_cb.set_callback(object); } + // writers DECLARE_WRITE8_MEMBER( write ); DECLARE_WRITE8_MEMBER( inflection_w ); @@ -84,7 +73,7 @@ private: UINT8 m_phoneme; // 6-bit phoneme value // outputs - devcb_resolved_write_line m_request_func; // request callback + devcb2_write_line m_request_cb; // callback for request UINT8 m_request_state; // request as seen to the outside world UINT8 m_internal_request; // request managed by stream timing diff --git a/src/mame/audio/gottlieb.c b/src/mame/audio/gottlieb.c index 0e85f17f380..dafa1d0ec0a 100644 --- a/src/mame/audio/gottlieb.c +++ b/src/mame/audio/gottlieb.c @@ -451,16 +451,6 @@ static const riot6532_interface gottlieb_riot6532_intf = }; -//------------------------------------------------- -// VOTRAX interface -//------------------------------------------------- - -static const votrax_sc01_interface gottlieb_votrax_interface = -{ - DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, gottlieb_sound_r1_device, votrax_request) -}; - - //------------------------------------------------- // audio CPU map //------------------------------------------------- @@ -498,7 +488,8 @@ MACHINE_CONFIG_FRAGMENT( gottlieb_sound_r1_with_votrax ) MCFG_FRAGMENT_ADD(gottlieb_sound_r1) // add the VOTRAX - MCFG_VOTRAX_SC01_ADD("votrax", 720000, gottlieb_votrax_interface) + MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) + MCFG_VOTRAX_SC01_REQUEST_CB(DEVWRITELINE(DEVICE_SELF_OWNER, gottlieb_sound_r1_device, votrax_request)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, DEVICE_SELF_OWNER, 0.50) MACHINE_CONFIG_END diff --git a/src/mess/drivers/votrpss.c b/src/mess/drivers/votrpss.c index 73b61ff5218..7fbef142ae4 100644 --- a/src/mess/drivers/votrpss.c +++ b/src/mess/drivers/votrpss.c @@ -256,10 +256,6 @@ static const ay8910_interface ay8910_intf = DEVCB_NULL // port B write }; -static struct votrax_sc01_interface votrax_interface = -{ -}; - WRITE8_MEMBER( votrpss_state::kbd_put ) { m_term_data = data; @@ -294,7 +290,7 @@ static MACHINE_CONFIG_START( votrpss, votrpss_state ) MCFG_SOUND_ADD("ay", AY8910, XTAL_8MHz/4) /* 2.000 MHz, verified */ MCFG_SOUND_CONFIG(ay8910_intf) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) - MCFG_VOTRAX_SC01_ADD("votrax", 720000, votrax_interface ) /* 720 kHz? needs verify */ + MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720 kHz? needs verify */ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* Devices */ diff --git a/src/mess/drivers/votrtnt.c b/src/mess/drivers/votrtnt.c index aa6cd522fe5..0c58ed43111 100644 --- a/src/mess/drivers/votrtnt.c +++ b/src/mess/drivers/votrtnt.c @@ -97,10 +97,6 @@ WRITE_LINE_MEMBER(votrtnt_state::write_acia_clock) m_acia->write_rxc(state); } -static struct votrax_sc01_interface votrtnt_votrax_interface = -{ - DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0) -}; /****************************************************************************** Machine Drivers @@ -128,7 +124,8 @@ static MACHINE_CONFIG_START( votrtnt, votrtnt_state ) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") - MCFG_VOTRAX_SC01_ADD("votrax", 720000, votrtnt_votrax_interface ) /* 720kHz? needs verify */ + MCFG_DEVICE_ADD("votrax", VOTRAX_SC01, 720000) /* 720kHz? needs verify */ + MCFG_VOTRAX_SC01_REQUEST_CB(INPUTLINE("maincpu", INPUT_LINE_IRQ0)) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END