From cfcedb58e2802c5cd38afd1cbde877ae9d71c2a5 Mon Sep 17 00:00:00 2001 From: andretuta Date: Tue, 24 Nov 2026 03:53:37 -0300 Subject: acphal: decode XMA contexts with runtime/xma_decoder when cargo is available Replace the hand-written C++ XMA2/WMA Pro decoder with the Rust decoder already on main. runtime/CMakeLists.txt builds it at configure time when cargo is on PATH and links it into gta6rt and acphal_test (LEONIDA_HAVE_XMA2_DECODER); without cargo, if that build fails, or with the cl.exe fallback, XMA voices output silence for each packet's frame count. The ring engine decodes whole 2048-byte packets: the read offset and the loop points are used per packet, so a loop plays its end packet in full and restarts with a fresh decoder at the packet holding the loop start. The C ABI gains leonida_xma2_decoder_create_hardware (no first-frame drop, no 64-sample start skip), since the context carries its own skip. Tested: acphal_test 129 checks (silence) and 125 checks (Rust decoder, gnullvm build), 0 failures, 3 runs each, clang 23 / mingw x64; cargo fmt and cargo test (gnullvm); pytest build/docs suites 204 passed. Co-Authored-By: Claude Opus 5.5 --- runtime/xma_decoder/leonida_xma2_decoder.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/xma_decoder/leonida_xma2_decoder.h') diff --git a/runtime/xma_decoder/leonida_xma2_decoder.h b/runtime/xma_decoder/leonida_xma2_decoder.h index 98dd5c49c..a4c5b4534 100644 --- a/runtime/xma_decoder/leonida_xma2_decoder.h +++ b/runtime/xma_decoder/leonida_xma2_decoder.h @@ -25,6 +25,10 @@ enum LeonidaXma2Status { int32_t leonida_xma2_decoder_create(uint32_t sample_rate, uint32_t channels, LeonidaXma2Decoder **out_decoder); +/* Like leonida_xma2_decoder_create, but decodes like the console's XMA hardware: the first + frame is kept and there is no 64-sample start skip; the caller applies the context's skip. */ +int32_t leonida_xma2_decoder_create_hardware(uint32_t sample_rate, uint32_t channels, + LeonidaXma2Decoder **out_decoder); int32_t leonida_xma2_decode_buffer(LeonidaXma2Decoder *decoder, const uint8_t *input, size_t input_len, LeonidaXma2PcmBlock **out_block); -- cgit v1.2.3