From 8d20e0cbc677f2ca552c194c1a1bf894c67fc9a8 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Sun, 30 Oct 2022 09:49:38 +0100 Subject: upd934g: Preliminary support for ACCENT/MUTE --- src/devices/sound/upd934g.cpp | 20 ++++++++++++-------- src/devices/sound/upd934g.h | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/devices/sound/upd934g.cpp b/src/devices/sound/upd934g.cpp index fc25628abbd..b57886685e1 100644 --- a/src/devices/sound/upd934g.cpp +++ b/src/devices/sound/upd934g.cpp @@ -7,7 +7,7 @@ Percussion Generator TODO: - - Play MUTED and ACCENTED + - Correct MUTED and ACCENTED (currently just changes volume) - T1 input - 8 channels? @@ -62,6 +62,7 @@ void upd934g_device::device_start() save_item(NAME(m_channel[i].pos), i); save_item(NAME(m_channel[i].playing), i); save_item(NAME(m_channel[i].volume), i); + save_item(NAME(m_channel[i].effect), i); } save_item(NAME(m_sample)); @@ -96,6 +97,11 @@ void upd934g_device::sound_stream_update(sound_stream &stream, std::vector(m_data_cb(m_channel[ch].pos)); + + // normal, muted, accented + const double adjust[] = { 0, 0.7, 0.4, 1.0 }; + raw *= adjust[m_channel[ch].effect]; + outputs[ch].put_int(i, raw * (m_channel[ch].volume + 1), 32768 / 64); if (++m_channel[ch].pos >= end) @@ -126,26 +132,24 @@ void upd934g_device::write(offs_t offset, uint8_t data) // --5432-- sample number // ------10 volume? m_sample = (data >> 2) & 0x0f; + switch (data >> 6) { case 0: logerror("CMD STORE ADDRESS sample %x\n", m_sample); break; case 1: - logerror("CMD PLAY sample %x (channel %d)\n", m_sample, m_sample >> 1); + case 2: + case 3: + logerror("CMD PLAY sample %x (channel %d, effect %d)\n", m_sample, m_sample >> 1, data >> 6); if (m_sample < 8) { m_channel[m_sample >> 1].pos = m_addr[m_sample]; m_channel[m_sample >> 1].playing = m_sample; m_channel[m_sample >> 1].volume = data & 0x03; + m_channel[m_sample >> 1].effect = data >> 6; } break; - case 2: - logerror("CMD PLAY MUTED sample %x (channel %d)\n", m_sample, m_sample >> 1); - break; - case 3: - logerror("CMD PLAY ACCENTED sample %x (channel %d)\n", m_sample, m_sample >> 1); - break; } break; case 1: diff --git a/src/devices/sound/upd934g.h b/src/devices/sound/upd934g.h index c61ac5a4910..1340dd7bf60 100644 --- a/src/devices/sound/upd934g.h +++ b/src/devices/sound/upd934g.h @@ -49,6 +49,7 @@ private: uint16_t pos; int playing; int volume; + int effect; } m_channel[4]; -- cgit v1.2.3