diff --git a/crates/xcl/src/hle/xaudio2.rs b/crates/xcl/src/hle/xaudio2.rs
index fae020df15..48046b682f 100644
--- a/crates/xcl/src/hle/xaudio2.rs
+++ b/crates/xcl/src/hle/xaudio2.rs
@@ -30,7 +30,7 @@
#![allow(non_snake_case)]
-use std::collections::HashMap;
+use std::collections::{HashMap, VecDeque};
use std::ffi::c_void;
use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex, OnceLock};
@@ -509,9 +509,13 @@ pub fn silent_buffer(i: &XmaInfo, b: &XAudio2Buffer, silence: *const u8, max_byt
/// or `DestroyVoice`.
struct DecodedBuffer {
orig_context: usize,
+ /// Submission order (`NEXT_BUFFER_SEQ`), so `GetState` can name the oldest queued buffer.
+ seq: u64,
_pcm: Box<[u8]>,
}
+static NEXT_BUFFER_SEQ: AtomicU64 = AtomicU64::new(0);
+
enum VoiceDecoder {
Opus(opus::Decoder),
Xma { decoder: xma2::Decoder, info: XmaInfo },
@@ -673,6 +677,51 @@ static DECODED_VOICES: Mutex