mirror of
https://github.com/holub/mame
synced 2025-06-07 13:23:50 +03:00
ym2203: Handle interrupt output as instant timer to prevent synchronization glitches
This commit is contained in:
parent
1a157c0600
commit
ad8165d99c
@ -15,8 +15,7 @@ const ssg_callbacks ym2203_device::psgintf =
|
||||
/* IRQ Handler */
|
||||
void ym2203_device::irq_handler(int irq)
|
||||
{
|
||||
if (!m_irq_handler.isnull())
|
||||
m_irq_handler(irq);
|
||||
m_timer[2]->adjust(attotime::zero, irq);
|
||||
}
|
||||
|
||||
/* Timer overflow callback from timer.c */
|
||||
@ -24,13 +23,18 @@ void ym2203_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case 0:
|
||||
case TIMER_A:
|
||||
ym2203_timer_over(m_chip,0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
case TIMER_B:
|
||||
ym2203_timer_over(m_chip,1);
|
||||
break;
|
||||
|
||||
case TIMER_IRQ_SYNC:
|
||||
if (!m_irq_handler.isnull())
|
||||
m_irq_handler(param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,8 +81,9 @@ void ym2203_device::device_start()
|
||||
m_irq_handler.resolve();
|
||||
|
||||
/* Timer Handler set */
|
||||
m_timer[0] = timer_alloc(0);
|
||||
m_timer[1] = timer_alloc(1);
|
||||
m_timer[0] = timer_alloc(TIMER_A);
|
||||
m_timer[1] = timer_alloc(TIMER_B);
|
||||
m_timer[2] = timer_alloc(TIMER_IRQ_SYNC);
|
||||
|
||||
/* stream system initialize */
|
||||
calculate_rates();
|
||||
|
@ -45,6 +45,13 @@ protected:
|
||||
void stream_generate(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
TIMER_A,
|
||||
TIMER_B,
|
||||
TIMER_IRQ_SYNC
|
||||
};
|
||||
|
||||
void irq_handler(int irq);
|
||||
void timer_handler(int c, int count, int clock);
|
||||
void update_request() { m_stream->update(); }
|
||||
@ -56,7 +63,7 @@ private:
|
||||
|
||||
// internal state
|
||||
sound_stream * m_stream;
|
||||
emu_timer * m_timer[2];
|
||||
emu_timer * m_timer[3];
|
||||
void * m_chip;
|
||||
devcb_write_line m_irq_handler;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user