From 6dc6efdbb58dad8f79d053f70b84550d6f99e53c Mon Sep 17 00:00:00 2001 From: hap Date: Sun, 2 Apr 2023 23:40:56 +0200 Subject: k053260: allow to change rev flag on the fly --- src/devices/sound/k053260.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/devices/sound/k053260.cpp b/src/devices/sound/k053260.cpp index 81a4e56704f..8f7bc7923c1 100644 --- a/src/devices/sound/k053260.cpp +++ b/src/devices/sound/k053260.cpp @@ -152,8 +152,8 @@ void k053260_device::device_reset() attotime period = attotime::from_ticks(16, clock()); m_timer->adjust(period, 0, period); - for (auto & elem : m_voice) - elem.voice_reset(); + for (auto & voice : m_voice) + voice.voice_reset(); } @@ -250,30 +250,33 @@ void k053260_device::write(offs_t offset, u8 data) // 0x04 through 0x07 seem to be unused - case 0x28: // key on/off + case 0x28: // key on/off and reverse { u8 rising_edge = data & ~m_keyon; for (int i = 0; i < 4; i++) { if (BIT(rising_edge, i)) - { - m_voice[i].set_reverse(BIT(data, 4 + i)); m_voice[i].key_on(); - } else if (!BIT(data, i)) m_voice[i].key_off(); } m_keyon = data; + + for (auto & voice : m_voice) + { + voice.set_reverse(data >> 4); + data >>= 1; + } break; } // 0x29 is a read register case 0x2a: // loop and pcm/adpcm select - for (auto & elem : m_voice) + for (auto & voice : m_voice) { - elem.set_loop_kadpcm(data); + voice.set_loop_kadpcm(data); data >>= 1; } break; -- cgit v1.2.3