mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
fix audio in jsrf and some other games
This commit is contained in:
@@ -1030,6 +1030,22 @@ static int voice_get_samples(MCPXAPUState *d, uint32_t v, float samples[][2],
|
||||
linear_addr += 4;
|
||||
}
|
||||
}
|
||||
/* WAR: Deactivate voice if ADPCM header values are non-zero
|
||||
* and identical. Something overwrites voice memory region
|
||||
* before NV1BA0_PIO_VOICE_OFF is set. Mitigates loud
|
||||
* crackling produced by decoding/playing such data.
|
||||
*/
|
||||
uint8_t *adpcm_hdr = (uint8_t *)adpcm_block;
|
||||
if (adpcm_hdr[0] != 0) {
|
||||
uint32_t diff = 0;
|
||||
for (uint8_t i = 1; i < 8; i++) {
|
||||
diff |= adpcm_hdr[i] ^ adpcm_hdr[0];
|
||||
}
|
||||
if (diff == 0) {
|
||||
voice_off(d, v);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
adpcm_decode_block(adpcm_decoded, (uint8_t *)adpcm_block,
|
||||
block_size, channels);
|
||||
adpcm_block_index = block_index;
|
||||
|
||||
Reference in New Issue
Block a user