AY: fix possible hang

This commit is contained in:
tildearrow 2022-05-16 13:37:41 -05:00
parent 0ae105ded3
commit 1675456693
2 changed files with 2 additions and 0 deletions

View File

@ -660,6 +660,7 @@ void DivPlatformAY8910::setFlags(unsigned int flags) {
break;
}
ay->device_start();
ay->device_reset();
stereo=(flags>>6)&1;
}

View File

@ -1063,6 +1063,7 @@ void ay8910_device::sound_stream_update(short** outputs, int outLen)
tone = &m_tone[chan];
const int period = tone->period * (m_step_mul << 1);
tone->count += is_expanded_mode() ? 32 : ((m_feature & PSG_HAS_EXPANDED_MODE) ? 1 : 2);
if (period==0) continue;
while (tone->count >= period)
{
tone->duty_cycle = (tone->duty_cycle - 1) & 0x1f;