CS423x: Playback powerdown check fixes

This commit is contained in:
RichardG867
2025-02-08 23:46:26 -03:00
parent 8d2150777c
commit 83b3b322ac

View File

@@ -606,8 +606,8 @@ cs423x_get_buffer(int32_t *buffer, int len, void *priv)
/* Output audio from the WSS codec, and also the OPL if we're in charge of it. */
ad1848_update(&dev->ad1848);
/* Don't output anything if the analog section is powered down. */
if (!(dev->indirect_regs[2] & 0xa4) && !(dev->indirect_regs[9] & 0x04)) {
/* Don't output anything if the analog section or DAC is powered down. */
if (!(dev->regs[2] & 0xb4) && !(dev->indirect_regs[9] & 0x04)) {
for (int c = 0; c < len * 2; c += 2) {
buffer[c] += dev->ad1848.buffer[c] / 2;
buffer[c + 1] += dev->ad1848.buffer[c + 1] / 2;
@@ -626,8 +626,9 @@ cs423x_get_music_buffer(int32_t *buffer, int len, void *priv)
if (dev->opl_wss) {
const int32_t *opl_buf = dev->sb->opl.update(dev->sb->opl.priv);
/* Don't output anything if the analog section or DAC2 (CS4235+) is powered down. */
if (!(dev->indirect_regs[2] & 0xa4) && !(dev->indirect_regs[9] & 0x06)) {
/* Don't output anything if the analog section, DAC (DAC2 instead on CS4235+) or FM synth is powered down. */
uint8_t bpd_mask = (dev->type >= CRYSTAL_CS4235) ? 0xb1 : 0xb5;
if (!(dev->regs[2] & bpd_mask) && !(dev->indirect_regs[9] & 0x06)) {
for (int c = 0; c < len * 2; c += 2) {
buffer[c] += (opl_buf[c] * dev->ad1848.fm_vol_l) >> 16;
buffer[c + 1] += (opl_buf[c + 1] * dev->ad1848.fm_vol_r) >> 16;