summaryrefslogtreecommitdiff
path: root/src/audio_core/renderer
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio_core/renderer')
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.cpp2
-rw-r--r--src/audio_core/renderer/adsp/audio_renderer.h1
-rw-r--r--src/audio_core/renderer/system_manager.cpp19
-rw-r--r--src/audio_core/renderer/system_manager.h7
4 files changed, 4 insertions, 25 deletions
diff --git a/src/audio_core/renderer/adsp/audio_renderer.cpp b/src/audio_core/renderer/adsp/audio_renderer.cpp
index 42b4b167a..503f40349 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.cpp
+++ b/src/audio_core/renderer/adsp/audio_renderer.cpp
@@ -189,6 +189,8 @@ void AudioRenderer::ThreadFunc() {
189 max_time = std::min(command_buffer.time_limit, max_time); 189 max_time = std::min(command_buffer.time_limit, max_time);
190 command_list_processor.SetProcessTimeMax(max_time); 190 command_list_processor.SetProcessTimeMax(max_time);
191 191
192 streams[index]->WaitFreeSpace();
193
192 // Process the command list 194 // Process the command list
193 { 195 {
194 MICROPROFILE_SCOPE(Audio_Renderer); 196 MICROPROFILE_SCOPE(Audio_Renderer);
diff --git a/src/audio_core/renderer/adsp/audio_renderer.h b/src/audio_core/renderer/adsp/audio_renderer.h
index 151f38c1b..85ce6a269 100644
--- a/src/audio_core/renderer/adsp/audio_renderer.h
+++ b/src/audio_core/renderer/adsp/audio_renderer.h
@@ -10,6 +10,7 @@
10#include "audio_core/renderer/adsp/command_buffer.h" 10#include "audio_core/renderer/adsp/command_buffer.h"
11#include "audio_core/renderer/adsp/command_list_processor.h" 11#include "audio_core/renderer/adsp/command_list_processor.h"
12#include "common/common_types.h" 12#include "common/common_types.h"
13#include "common/polyfill_thread.h"
13#include "common/reader_writer_queue.h" 14#include "common/reader_writer_queue.h"
14#include "common/thread.h" 15#include "common/thread.h"
15 16
diff --git a/src/audio_core/renderer/system_manager.cpp b/src/audio_core/renderer/system_manager.cpp
index ce631f810..07d8ed093 100644
--- a/src/audio_core/renderer/system_manager.cpp
+++ b/src/audio_core/renderer/system_manager.cpp
@@ -15,14 +15,9 @@ MICROPROFILE_DEFINE(Audio_RenderSystemManager, "Audio", "Render System Manager",
15 MP_RGB(60, 19, 97)); 15 MP_RGB(60, 19, 97));
16 16
17namespace AudioCore::AudioRenderer { 17namespace AudioCore::AudioRenderer {
18constexpr std::chrono::nanoseconds RENDER_TIME{5'000'000UL};
19 18
20SystemManager::SystemManager(Core::System& core_) 19SystemManager::SystemManager(Core::System& core_)
21 : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()}, 20 : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()} {}
22 thread_event{Core::Timing::CreateEvent(
23 "AudioRendererSystemManager", [this](std::uintptr_t, s64 time, std::chrono::nanoseconds) {
24 return ThreadFunc2(time);
25 })} {}
26 21
27SystemManager::~SystemManager() { 22SystemManager::~SystemManager() {
28 Stop(); 23 Stop();
@@ -33,8 +28,6 @@ bool SystemManager::InitializeUnsafe() {
33 if (adsp.Start()) { 28 if (adsp.Start()) {
34 active = true; 29 active = true;
35 thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(); }); 30 thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(); });
36 core.CoreTiming().ScheduleLoopingEvent(std::chrono::nanoseconds(0), RENDER_TIME,
37 thread_event);
38 } 31 }
39 } 32 }
40 33
@@ -45,7 +38,6 @@ void SystemManager::Stop() {
45 if (!active) { 38 if (!active) {
46 return; 39 return;
47 } 40 }
48 core.CoreTiming().UnscheduleEvent(thread_event, {});
49 active = false; 41 active = false;
50 update.store(true); 42 update.store(true);
51 update.notify_all(); 43 update.notify_all();
@@ -111,16 +103,7 @@ void SystemManager::ThreadFunc() {
111 103
112 adsp.Signal(); 104 adsp.Signal();
113 adsp.Wait(); 105 adsp.Wait();
114
115 update.wait(false);
116 update.store(false);
117 } 106 }
118} 107}
119 108
120std::optional<std::chrono::nanoseconds> SystemManager::ThreadFunc2(s64 time) {
121 update.store(true);
122 update.notify_all();
123 return std::nullopt;
124}
125
126} // namespace AudioCore::AudioRenderer 109} // namespace AudioCore::AudioRenderer
diff --git a/src/audio_core/renderer/system_manager.h b/src/audio_core/renderer/system_manager.h
index 415ddb74f..1f0bbd8b4 100644
--- a/src/audio_core/renderer/system_manager.h
+++ b/src/audio_core/renderer/system_manager.h
@@ -68,11 +68,6 @@ private:
68 */ 68 */
69 void ThreadFunc(); 69 void ThreadFunc();
70 70
71 /**
72 * Signalling core timing thread to run ThreadFunc.
73 */
74 std::optional<std::chrono::nanoseconds> ThreadFunc2(s64 time);
75
76 enum class StreamState { 71 enum class StreamState {
77 Filling, 72 Filling,
78 Steady, 73 Steady,
@@ -95,8 +90,6 @@ private:
95 ADSP::ADSP& adsp; 90 ADSP::ADSP& adsp;
96 /// AudioRenderer mailbox for communication 91 /// AudioRenderer mailbox for communication
97 ADSP::AudioRenderer_Mailbox* mailbox{}; 92 ADSP::AudioRenderer_Mailbox* mailbox{};
98 /// Core timing event to signal main thread
99 std::shared_ptr<Core::Timing::EventType> thread_event;
100 /// Atomic for main thread to wait on 93 /// Atomic for main thread to wait on
101 std::atomic<bool> update{}; 94 std::atomic<bool> update{};
102}; 95};