k051649: more logical channel halt

This commit is contained in:
hap 2023-07-06 15:52:50 +02:00
parent e1cd6bc09b
commit e625a977c1

View File

@ -136,22 +136,26 @@ void k051649_device::sound_stream_update(sound_stream &stream, std::vector<read_
for (int i = 0; i < outputs[0].samples(); i++) for (int i = 0; i < outputs[0].samples(); i++)
{ {
for (sound_channel &voice : m_channel_list) for (sound_channel &voice : m_channel_list)
{
// channel is halted for freq < 9
if (voice.frequency > 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.counter = (voice.counter + 1) & 0x1f;
voice.clock = voice.frequency; voice.clock = voice.frequency;
} }
}
// scale to 11 bit digital output on chip // scale to 11 bit digital output on chip
if (voice.key) if (voice.key)
outputs[0].add_int(i, (voice.waveram[voice.counter] * voice.volume) >> 4, 1024); outputs[0].add_int(i, (voice.waveram[voice.counter] * voice.volume) >> 4, 1024);
} }
else if (voice.clock > 0)
voice.clock--;
}
} }
} }