summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/spg2xx_audio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/spg2xx_audio.cpp')
-rw-r--r--src/devices/machine/spg2xx_audio.cpp52
1 files changed, 18 insertions, 34 deletions
diff --git a/src/devices/machine/spg2xx_audio.cpp b/src/devices/machine/spg2xx_audio.cpp
index 2441ebf17ce..2cf0fd822d8 100644
--- a/src/devices/machine/spg2xx_audio.cpp
+++ b/src/devices/machine/spg2xx_audio.cpp
@@ -24,15 +24,15 @@ DEFINE_DEVICE_TYPE(SPG2XX_AUDIO, spg2xx_audio_device, "spg2xx_audio", "SPG2xx-se
DEFINE_DEVICE_TYPE(SPG110_AUDIO, spg110_audio_device, "spg110_audio", "SPG110-series System-on-a-Chip Audio")
DEFINE_DEVICE_TYPE(SUNPLUS_GCM394_AUDIO, sunplus_gcm394_audio_device, "gcm394_audio", "SunPlus GCM394 System-on-a-Chip (Audio)")
-#define LOG_SPU_READS (1U << 0)
-#define LOG_SPU_WRITES (1U << 1)
-#define LOG_UNKNOWN_SPU (1U << 2)
-#define LOG_CHANNEL_READS (1U << 3)
-#define LOG_CHANNEL_WRITES (1U << 4)
-#define LOG_ENVELOPES (1U << 5)
-#define LOG_SAMPLES (1U << 6)
-#define LOG_RAMPDOWN (1U << 7)
-#define LOG_BEAT (1U << 8)
+#define LOG_SPU_READS (1U << 1)
+#define LOG_SPU_WRITES (1U << 2)
+#define LOG_UNKNOWN_SPU (1U << 3)
+#define LOG_CHANNEL_READS (1U << 4)
+#define LOG_CHANNEL_WRITES (1U << 5)
+#define LOG_ENVELOPES (1U << 6)
+#define LOG_SAMPLES (1U << 7)
+#define LOG_RAMPDOWN (1U << 8)
+#define LOG_BEAT (1U << 9)
#define LOG_ALL (LOG_SPU_READS | LOG_SPU_WRITES | LOG_UNKNOWN_SPU | LOG_CHANNEL_READS | LOG_CHANNEL_WRITES \
| LOG_ENVELOPES | LOG_SAMPLES | LOG_RAMPDOWN | LOG_BEAT)
@@ -50,7 +50,7 @@ static FILE *adpcm_file[16] = {};
spg2xx_audio_device::spg2xx_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, type, tag, owner, clock)
, device_sound_interface(mconfig, *this)
- , m_space_read_cb(*this)
+ , m_space_read_cb(*this, 0)
, m_irq_cb(*this)
, m_ch_irq_cb(*this)
{
@@ -73,7 +73,7 @@ sunplus_gcm394_audio_device::sunplus_gcm394_audio_device(const machine_config &m
void spg2xx_audio_device::device_start()
{
- m_audio_beat = timer_alloc(TIMER_BEAT);
+ m_audio_beat = timer_alloc(FUNC(spg2xx_audio_device::audio_beat_tick), this);
m_audio_beat->adjust(attotime::never);
m_stream = stream_alloc(0, 2, 281250/4);
@@ -107,13 +107,9 @@ void spg2xx_audio_device::device_start()
memset(m_adpcm36_state + i, 0, sizeof(adpcm36_state));
- m_channel_irq[i] = timer_alloc(TIMER_IRQ + i);
+ m_channel_irq[i] = timer_alloc(FUNC(spg2xx_audio_device::irq_tick), this);
m_channel_irq[i]->adjust(attotime::never);
}
-
- m_space_read_cb.resolve_safe(0);
- m_irq_cb.resolve();
- m_ch_irq_cb.resolve();
}
void spg2xx_audio_device::device_reset()
@@ -159,24 +155,12 @@ void spg2xx_audio_device::device_stop()
#endif
}
-void spg2xx_audio_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+TIMER_CALLBACK_MEMBER(spg2xx_audio_device::irq_tick)
{
- if (id >= TIMER_IRQ && id < (TIMER_IRQ + 16))
- {
- const uint32_t bit = id - TIMER_IRQ;
- if (!BIT(m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS], bit))
- {
- m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS] |= (1 << (id - TIMER_IRQ));
- m_ch_irq_cb(1);
- }
- return;
- }
-
- switch (id)
+ if (!BIT(m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS], param))
{
- case TIMER_BEAT:
- audio_beat_tick();
- break;
+ m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_STATUS] |= (1 << param);
+ m_ch_irq_cb(1);
}
}
@@ -480,7 +464,7 @@ void spg2xx_audio_device::audio_ctrl_w(offs_t offset, uint16_t data)
m_audio_ctrl_regs[offset] |= mask;
if (BIT(m_audio_ctrl_regs[AUDIO_CHANNEL_FIQ_ENABLE], channel_bit))
{
- m_channel_irq[channel_bit]->adjust(attotime::from_hz(m_channel_rate[channel_bit]), 0, attotime::from_hz(m_channel_rate[channel_bit]));
+ m_channel_irq[channel_bit]->adjust(attotime::from_hz(m_channel_rate[channel_bit]), channel_bit, attotime::from_hz(m_channel_rate[channel_bit]));
}
else
{
@@ -1250,7 +1234,7 @@ inline void spg2xx_audio_device::loop_channel(const uint32_t channel)
LOGMASKED(LOG_SAMPLES, "Channel %d: Looping to address %08x\n", channel, m_sample_addr[channel]);
}
-void spg2xx_audio_device::audio_beat_tick()
+TIMER_CALLBACK_MEMBER(spg2xx_audio_device::audio_beat_tick)
{
if (m_audio_curr_beat_base_count > 0)
{