From e625a977c10c94c1181821ef07fb9ffa19f42fe0 Mon Sep 17 00:00:00 2001 From: hap Date: Thu, 6 Jul 2023 15:52:50 +0200 Subject: [PATCH] k051649: more logical channel halt --- src/devices/sound/k051649.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/devices/sound/k051649.cpp b/src/devices/sound/k051649.cpp index e98ad04d6d9..97fc9ca9298 100644 --- a/src/devices/sound/k051649.cpp +++ b/src/devices/sound/k051649.cpp @@ -137,20 +137,24 @@ void k051649_device::sound_stream_update(sound_stream &stream, std::vector 8) + if (--voice.clock < 0) { - if (--voice.clock < 0) + // channel is halted for freq < 9 + if (voice.frequency < 9) + { + voice.clock = 0; + continue; + } + else { voice.counter = (voice.counter + 1) & 0x1f; voice.clock = voice.frequency; } - // scale to 11 bit digital output on chip - if (voice.key) - outputs[0].add_int(i, (voice.waveram[voice.counter] * voice.volume) >> 4, 1024); } - else if (voice.clock > 0) - voice.clock--; + + // scale to 11 bit digital output on chip + if (voice.key) + outputs[0].add_int(i, (voice.waveram[voice.counter] * voice.volume) >> 4, 1024); } } }