[XMA] Added SignalWork calls in XMASetInputBuffer{0,1}Valid

This should wake up the XMA decoder worker thread when new audio data is
provided instead of only when the contexts are initially enabled or
decoder is shutting down.
This commit is contained in:
Herman S.
2025-11-03 14:38:58 +09:00
parent ebf356187e
commit 40c19a9085
2 changed files with 18 additions and 0 deletions
+6
View File
@@ -51,6 +51,12 @@ class XmaDecoder {
void Pause();
void Resume();
void SignalWork() {
if (work_event_) {
work_event_->Set();
}
}
protected:
int GetContextId(uint32_t guest_ptr);
@@ -260,6 +260,12 @@ dword_result_t XMASetInputBuffer0Valid_entry(lpvoid_t context_ptr) {
context.input_buffer_0_valid = 1;
context.Store(context_ptr);
// Wake up the worker thread so it can process the new input data.
auto audio_system = kernel_state()->emulator()->audio_system();
if (audio_system) {
audio_system->xma_decoder()->SignalWork();
}
return 0;
}
DECLARE_XBOXKRNL_EXPORT2(XMASetInputBuffer0Valid, kAudio, kImplemented,
@@ -301,6 +307,12 @@ dword_result_t XMASetInputBuffer1Valid_entry(lpvoid_t context_ptr) {
context.input_buffer_1_valid = 1;
context.Store(context_ptr);
// Wake up the worker thread so it can process the new input data.
auto audio_system = kernel_state()->emulator()->audio_system();
if (audio_system) {
audio_system->xma_decoder()->SignalWork();
}
return 0;
}
DECLARE_XBOXKRNL_EXPORT2(XMASetInputBuffer1Valid, kAudio, kImplemented,