summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/sound
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-06-30 16:39:00 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-06-30 16:39:00 -0400
commit834867ce58522080771035166bd7f7c956a7e17a (patch)
treee0cbadb8d9a4ec1cabe5bcded10f1faa3d12bafa /src/devices/sound
parent95d60edf0a9dddde7ed0ec1aafb2e9f5add0dcf2 (diff)
ym3812: Synchronize IRQ outputs to prevent lossage (nw)
Diffstat (limited to 'src/devices/sound')
-rw-r--r--src/devices/sound/3812intf.cpp17
-rw-r--r--src/devices/sound/3812intf.h9
2 files changed, 19 insertions, 7 deletions
diff --git a/src/devices/sound/3812intf.cpp b/src/devices/sound/3812intf.cpp
index c234554febc..6818a531371 100644
--- a/src/devices/sound/3812intf.cpp
+++ b/src/devices/sound/3812intf.cpp
@@ -25,8 +25,7 @@
void ym3812_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 */
@@ -34,13 +33,18 @@ void ym3812_device::device_timer(emu_timer &timer, device_timer_id id, int param
{
switch(id)
{
- case 0:
+ case TIMER_A:
ym3812_timer_over(m_chip,0);
break;
- case 1:
+ case TIMER_B:
ym3812_timer_over(m_chip,1);
break;
+
+ case TIMER_IRQ_SYNC:
+ if (!m_irq_handler.isnull())
+ m_irq_handler(param);
+ break;
}
}
@@ -87,8 +91,9 @@ void ym3812_device::device_start()
ym3812_set_irq_handler (m_chip, ym3812_device::static_irq_handler, this);
ym3812_set_update_handler(m_chip, ym3812_device::static_update_request, this);
- 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);
}
void ym3812_device::device_clock_changed()
diff --git a/src/devices/sound/3812intf.h b/src/devices/sound/3812intf.h
index e9a17944c17..910b51521ba 100644
--- a/src/devices/sound/3812intf.h
+++ b/src/devices/sound/3812intf.h
@@ -36,6 +36,13 @@ protected:
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
private:
+ enum
+ {
+ TIMER_A,
+ TIMER_B,
+ TIMER_IRQ_SYNC
+ };
+
void irq_handler(int irq);
void timer_handler(int c, const attotime &period);
void update_request() { m_stream->update(); }
@@ -47,7 +54,7 @@ private:
static void static_update_request(device_t *param, int interval) { downcast<ym3812_device *>(param)->update_request(); }
sound_stream * m_stream;
- emu_timer * m_timer[2];
+ emu_timer * m_timer[3];
void * m_chip;
devcb_write_line m_irq_handler;
};