src/emu/sound/asc.c
| r12133 | r12134 | |
| 39 | 39 | // LIVE DEVICE |
| 40 | 40 | //************************************************************************** |
| 41 | 41 | |
| 42 | | // does nothing, this timer exists only to make MAME sync itself at our audio rate |
| 43 | | static TIMER_CALLBACK( sync_timer_cb ) |
| 44 | | { |
| 45 | | asc_device *pDevice = (asc_device *)ptr; |
| 46 | | |
| 47 | | pDevice->m_stream->update(); |
| 48 | | } |
| 49 | | |
| 50 | 42 | //------------------------------------------------- |
| 51 | 43 | // asc_device - constructor |
| 52 | 44 | //------------------------------------------------- |
| r12133 | r12134 | |
| 94 | 86 | |
| 95 | 87 | memset(m_regs, 0, sizeof(m_regs)); |
| 96 | 88 | |
| 97 | | m_sync_timer = this->machine().scheduler().timer_alloc(FUNC(sync_timer_cb), this); |
| 89 | m_timer = timer_alloc(0, NULL); |
| 98 | 90 | |
| 99 | 91 | save_item(NAME(m_fifo_a_rdptr)); |
| 100 | 92 | save_item(NAME(m_fifo_b_rdptr)); |
| r12133 | r12134 | |
| 130 | 122 | } |
| 131 | 123 | |
| 132 | 124 | //------------------------------------------------- |
| 125 | // device_timer - called when our device timer expires |
| 126 | //------------------------------------------------- |
| 127 | |
| 128 | void asc_device::device_timer(emu_timer &timer, device_timer_id tid, int param, void *ptr) |
| 129 | { |
| 130 | m_stream->update(); |
| 131 | } |
| 132 | |
| 133 | //------------------------------------------------- |
| 133 | 134 | // sound_stream_update - handle update requests for |
| 134 | 135 | // our sound stream |
| 135 | 136 | //------------------------------------------------- |
| r12133 | r12134 | |
| 467 | 468 | |
| 468 | 469 | if (data != 0) |
| 469 | 470 | { |
| 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)); |
| 471 | 472 | } |
| 472 | 473 | else |
| 473 | 474 | { |
| 474 | | m_sync_timer->adjust(attotime::never); |
| 475 | m_timer->adjust(attotime::never); |
| 475 | 476 | } |
| 476 | 477 | } |
| 477 | 478 | break; |
src/emu/sound/asc.h
| r12133 | r12134 | |
| 100 | 100 | // device-level overrides |
| 101 | 101 | virtual void device_start(); |
| 102 | 102 | virtual void device_reset(); |
| 103 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| 103 | 104 | |
| 104 | 105 | virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples); |
| 105 | 106 | |
| r12133 | r12134 | |
| 118 | 119 | int m_fifo_a_wrptr, m_fifo_b_wrptr; |
| 119 | 120 | int m_fifo_cap_a, m_fifo_cap_b; |
| 120 | 121 | |
| 121 | | emu_timer *m_sync_timer; |
| 122 | emu_timer *m_timer; |
| 122 | 123 | }; |
| 123 | 124 | |
| 124 | 125 | |