From 1675456693c6241edd9fa04f7e4ddcfbd6bfde56 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Mon, 16 May 2022 13:37:41 -0500 Subject: [PATCH] AY: fix possible hang --- src/engine/platform/ay.cpp | 1 + src/engine/platform/sound/ay8910.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/engine/platform/ay.cpp b/src/engine/platform/ay.cpp index 94546ed1d..329af9585 100644 --- a/src/engine/platform/ay.cpp +++ b/src/engine/platform/ay.cpp @@ -660,6 +660,7 @@ void DivPlatformAY8910::setFlags(unsigned int flags) { break; } ay->device_start(); + ay->device_reset(); stereo=(flags>>6)&1; } diff --git a/src/engine/platform/sound/ay8910.cpp b/src/engine/platform/sound/ay8910.cpp index 3dddf82c5..7b38ad319 100644 --- a/src/engine/platform/sound/ay8910.cpp +++ b/src/engine/platform/sound/ay8910.cpp @@ -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;