From 08da777e844e61e012096e72dfa158a7fd36935c Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 21 Jul 2023 13:23:59 +0200 Subject: [PATCH] The WSS get buffer function now correctly ignores OPL if OPL is disabled. --- src/sound/snd_wss.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sound/snd_wss.c b/src/sound/snd_wss.c index a3a748374..d82e5e6f9 100644 --- a/src/sound/snd_wss.c +++ b/src/sound/snd_wss.c @@ -79,15 +79,20 @@ static void wss_get_buffer(int32_t *buffer, int len, void *priv) { wss_t *wss = (wss_t *) priv; + int32_t *opl_buf + + if (wss->opl_enabled) + opl_buf = wss->opl.update(wss->opl.priv); - int32_t *opl_buf = wss->opl.update(wss->opl.priv); ad1848_update(&wss->ad1848); for (int c = 0; c < len * 2; c++) { - buffer[c] += opl_buf[c]; + if (wss->opl_enabled) + buffer[c] += opl_buf[c]; buffer[c] += wss->ad1848.buffer[c] / 2; } - wss->opl.reset_buffer(wss->opl.priv); + if (wss->opl_enabled) + wss->opl.reset_buffer(wss->opl.priv); wss->ad1848.pos = 0; }