summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Kelebek12021-06-20 15:23:16 +0100
committerGravatar Kelebek12021-06-27 15:58:07 +0100
commit0857d6a3dbcaeb30b51326419fb56d9b543601f1 (patch)
tree26221ce096533b188aa1fe8d7e82290780edee1d /src/core
parentMerge pull request #6526 from bunnei/doom-update (diff)
downloadyuzu-0857d6a3dbcaeb30b51326419fb56d9b543601f1.tar.gz
yuzu-0857d6a3dbcaeb30b51326419fb56d9b543601f1.tar.xz
yuzu-0857d6a3dbcaeb30b51326419fb56d9b543601f1.zip
Decouple audio processing and run at variable rate
Currently, processing of audio samples is called from AudioRenderer's Update method, using a fixed 4 buffers to process the given samples. Games call Update at variable rates, depending on framerate and/or sample count, which causes inconsistency in audio processing. From what I've seen, 60 FPS games update every ~0.004s, but 30 FPS/160 sample games update somewhere between 0.02 and 0.04, 5-10x slower. Not enough samples get fed to the backend, leading to a lot of audio skipping. This PR seeks to address this by de-coupling the audio consumption and the audio update. Update remains the same without calling for buffer queuing, and the consume now schedules itself to run based on the sample rate and count.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/audio/audren_u.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/core/hle/service/audio/audren_u.cpp b/src/core/hle/service/audio/audren_u.cpp
index 800feba6e..feb5150e1 100644
--- a/src/core/hle/service/audio/audren_u.cpp
+++ b/src/core/hle/service/audio/audren_u.cpp
@@ -110,17 +110,19 @@ private:
110 void Start(Kernel::HLERequestContext& ctx) { 110 void Start(Kernel::HLERequestContext& ctx) {
111 LOG_WARNING(Service_Audio, "(STUBBED) called"); 111 LOG_WARNING(Service_Audio, "(STUBBED) called");
112 112
113 IPC::ResponseBuilder rb{ctx, 2}; 113 const auto result = renderer->Start();
114 114
115 rb.Push(ResultSuccess); 115 IPC::ResponseBuilder rb{ctx, 2};
116 rb.Push(result);
116 } 117 }
117 118
118 void Stop(Kernel::HLERequestContext& ctx) { 119 void Stop(Kernel::HLERequestContext& ctx) {
119 LOG_WARNING(Service_Audio, "(STUBBED) called"); 120 LOG_WARNING(Service_Audio, "(STUBBED) called");
120 121
121 IPC::ResponseBuilder rb{ctx, 2}; 122 const auto result = renderer->Stop();
122 123
123 rb.Push(ResultSuccess); 124 IPC::ResponseBuilder rb{ctx, 2};
125 rb.Push(result);
124 } 126 }
125 127
126 void QuerySystemEvent(Kernel::HLERequestContext& ctx) { 128 void QuerySystemEvent(Kernel::HLERequestContext& ctx) {