From be7bb04c6bb22597ec557fb961893e4060abeb34 Mon Sep 17 00:00:00 2001 From: SarahW Date: Wed, 10 Jan 2018 18:48:11 +0000 Subject: [PATCH] Implemented Sound Blaster DSP busy cycling when playing DMA audio. Fixes stalls in Wing Commander : Privateer when sound enabled. --- src/sound_sb_dsp.c | 6 +++++- src/sound_sb_dsp.h | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sound_sb_dsp.c b/src/sound_sb_dsp.c index 6aebef1..fb1532a 100644 --- a/src/sound_sb_dsp.c +++ b/src/sound_sb_dsp.c @@ -685,7 +685,11 @@ uint8_t sb_read(uint16_t a, void *priv) // pclog("SB read %02X\n",sbreaddat); return dsp->sbreaddat; case 0xC: /*Write data ready*/ - if (dsp->wb_full) + if (dsp->sb_8_enable || dsp->sb_type >= SB16 ) + dsp->busy_count = (dsp->busy_count + 1) & 15; + else + dsp->busy_count = 0; + if (dsp->wb_full || (dsp->busy_count & 8)) { dsp->wb_full = dsp->wb_time; return 0xff; diff --git a/src/sound_sb_dsp.h b/src/sound_sb_dsp.h index 3c100e5..68f260a 100644 --- a/src/sound_sb_dsp.h +++ b/src/sound_sb_dsp.h @@ -58,6 +58,8 @@ typedef struct sb_dsp_t int asp_data_len; int wb_time, wb_full; + + int busy_count; int record_pos_read; int record_pos_write;