Previous 15994 Revisions Next

r12134 Sunday 3rd July, 2011 at 02:36:49 UTC by R. Belmont
ASC: minor cleanup; use device timer instead of stand-alone [R. Belmont]
[src/emu/sound]asc.c asc.h

src/emu/sound/asc.c
r12133r12134
3939//  LIVE DEVICE
4040//**************************************************************************
4141
42// does nothing, this timer exists only to make MAME sync itself at our audio rate
43static TIMER_CALLBACK( sync_timer_cb )
44{
45   asc_device *pDevice = (asc_device *)ptr;
46
47   pDevice->m_stream->update();
48}
49
5042//-------------------------------------------------
5143//  asc_device - constructor
5244//-------------------------------------------------
r12133r12134
9486
9587   memset(m_regs, 0, sizeof(m_regs));
9688
97   m_sync_timer = this->machine().scheduler().timer_alloc(FUNC(sync_timer_cb), this);
89   m_timer = timer_alloc(0, NULL);
9890
9991   save_item(NAME(m_fifo_a_rdptr));
10092   save_item(NAME(m_fifo_b_rdptr));
r12133r12134
130122}
131123
132124//-------------------------------------------------
125//  device_timer - called when our device timer expires
126//-------------------------------------------------
127
128void asc_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr)
129{
130   m_stream->update();
131}
132
133//-------------------------------------------------
133134//  sound_stream_update - handle update requests for
134135//  our sound stream
135136//-------------------------------------------------
r12133r12134
467468
468469               if (data != 0)
469470               {
470                  m_sync_timer->adjust(attotime::zero, 0, attotime::from_hz(22257/4));
471                  m_timer->adjust(attotime::zero, 0, attotime::from_hz(22257/4));
471472               }
472473               else
473474               {
474                  m_sync_timer->adjust(attotime::never);
475                  m_timer->adjust(attotime::never);
475476               }
476477            }
477478            break;
src/emu/sound/asc.h
r12133r12134
100100   // device-level overrides
101101   virtual void device_start();
102102   virtual void device_reset();
103   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
103104
104105   virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
105106
r12133r12134
118119   int   m_fifo_a_wrptr, m_fifo_b_wrptr;
119120   int    m_fifo_cap_a, m_fifo_cap_b;
120121
121   emu_timer *m_sync_timer;
122    emu_timer *m_timer;
122123};
123124
124125

Previous 15994 Revisions Next


© 1998-2018 The MESS Team