diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/renderer/adsp/adsp.cpp | 2 | ||||
-rw-r--r-- | src/audio_core/renderer/adsp/audio_renderer.cpp | 2 | ||||
-rw-r--r-- | src/audio_core/renderer/adsp/audio_renderer.h | 1 | ||||
-rw-r--r-- | src/audio_core/renderer/adsp/command_list_processor.cpp | 2 | ||||
-rw-r--r-- | src/audio_core/renderer/system.cpp | 3 | ||||
-rw-r--r-- | src/audio_core/renderer/system_manager.cpp | 19 | ||||
-rw-r--r-- | src/audio_core/renderer/system_manager.h | 7 |
7 files changed, 7 insertions, 29 deletions
diff --git a/src/audio_core/renderer/adsp/adsp.cpp b/src/audio_core/renderer/adsp/adsp.cpp index a28395663..74772fc50 100644 --- a/src/audio_core/renderer/adsp/adsp.cpp +++ b/src/audio_core/renderer/adsp/adsp.cpp @@ -13,7 +13,7 @@ namespace AudioCore::AudioRenderer::ADSP { ADSP::ADSP(Core::System& system_, Sink::Sink& sink_) - : system{system_}, memory{system.Memory()}, sink{sink_} {} + : system{system_}, memory{system.ApplicationMemory()}, sink{sink_} {} ADSP::~ADSP() { ClearCommandBuffers(); 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() { max_time = std::min(command_buffer.time_limit, max_time); command_list_processor.SetProcessTimeMax(max_time); + streams[index]->WaitFreeSpace(); + // Process the command list { 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 @@ #include "audio_core/renderer/adsp/command_buffer.h" #include "audio_core/renderer/adsp/command_list_processor.h" #include "common/common_types.h" +#include "common/polyfill_thread.h" #include "common/reader_writer_queue.h" #include "common/thread.h" diff --git a/src/audio_core/renderer/adsp/command_list_processor.cpp b/src/audio_core/renderer/adsp/command_list_processor.cpp index e3bf2d7ec..7a300d216 100644 --- a/src/audio_core/renderer/adsp/command_list_processor.cpp +++ b/src/audio_core/renderer/adsp/command_list_processor.cpp @@ -17,7 +17,7 @@ namespace AudioCore::AudioRenderer::ADSP { void CommandListProcessor::Initialize(Core::System& system_, CpuAddr buffer, u64 size, Sink::SinkStream* stream_) { system = &system_; - memory = &system->Memory(); + memory = &system->ApplicationMemory(); stream = stream_; header = reinterpret_cast<CommandListHeader*>(buffer); commands = reinterpret_cast<u8*>(buffer + sizeof(CommandListHeader)); diff --git a/src/audio_core/renderer/system.cpp b/src/audio_core/renderer/system.cpp index 28f063641..ad869facb 100644 --- a/src/audio_core/renderer/system.cpp +++ b/src/audio_core/renderer/system.cpp @@ -127,8 +127,7 @@ Result System::Initialize(const AudioRendererParameterInternal& params, render_device = params.rendering_device; execution_mode = params.execution_mode; - core.Memory().ZeroBlock(*core.ApplicationProcess(), transfer_memory->GetSourceAddress(), - transfer_memory_size); + core.ApplicationMemory().ZeroBlock(transfer_memory->GetSourceAddress(), transfer_memory_size); // Note: We're not actually using the transfer memory because it's a pain to code for. // Allocate the memory normally instead and hope the game doesn't try to read anything back 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", MP_RGB(60, 19, 97)); namespace AudioCore::AudioRenderer { -constexpr std::chrono::nanoseconds RENDER_TIME{5'000'000UL}; SystemManager::SystemManager(Core::System& core_) - : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()}, - thread_event{Core::Timing::CreateEvent( - "AudioRendererSystemManager", [this](std::uintptr_t, s64 time, std::chrono::nanoseconds) { - return ThreadFunc2(time); - })} {} + : core{core_}, adsp{core.AudioCore().GetADSP()}, mailbox{adsp.GetRenderMailbox()} {} SystemManager::~SystemManager() { Stop(); @@ -33,8 +28,6 @@ bool SystemManager::InitializeUnsafe() { if (adsp.Start()) { active = true; thread = std::jthread([this](std::stop_token stop_token) { ThreadFunc(); }); - core.CoreTiming().ScheduleLoopingEvent(std::chrono::nanoseconds(0), RENDER_TIME, - thread_event); } } @@ -45,7 +38,6 @@ void SystemManager::Stop() { if (!active) { return; } - core.CoreTiming().UnscheduleEvent(thread_event, {}); active = false; update.store(true); update.notify_all(); @@ -111,16 +103,7 @@ void SystemManager::ThreadFunc() { adsp.Signal(); adsp.Wait(); - - update.wait(false); - update.store(false); } } -std::optional<std::chrono::nanoseconds> SystemManager::ThreadFunc2(s64 time) { - update.store(true); - update.notify_all(); - return std::nullopt; -} - } // 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: */ void ThreadFunc(); - /** - * Signalling core timing thread to run ThreadFunc. - */ - std::optional<std::chrono::nanoseconds> ThreadFunc2(s64 time); - enum class StreamState { Filling, Steady, @@ -95,8 +90,6 @@ private: ADSP::ADSP& adsp; /// AudioRenderer mailbox for communication ADSP::AudioRenderer_Mailbox* mailbox{}; - /// Core timing event to signal main thread - std::shared_ptr<Core::Timing::EventType> thread_event; /// Atomic for main thread to wait on std::atomic<bool> update{}; }; |