From f7884242c7e31b516d56ba4d9f4ac5ce2155f13d Mon Sep 17 00:00:00 2001 From: robojumper Date: Sun, 25 May 2025 16:29:42 +0200 Subject: Import of more nw4r::snd from https://github.com/kiwi515/ogws Co-authored-by: kiwi515 <49212064+kiwi515@users.noreply.github.com> --- src/nw4r/snd/snd_SoundSystem.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/nw4r/snd/snd_SoundSystem.cpp') diff --git a/src/nw4r/snd/snd_SoundSystem.cpp b/src/nw4r/snd/snd_SoundSystem.cpp index 01afc6d4..ef27f5a5 100644 --- a/src/nw4r/snd/snd_SoundSystem.cpp +++ b/src/nw4r/snd/snd_SoundSystem.cpp @@ -78,6 +78,27 @@ namespace nw4r { namespace snd namespace nw4r { namespace snd { +void SoundSystem::InitSoundSystem(s32 soundThreadPriority, + s32 dvdThreadPriority) { + const int defaultWorkSize = DEFAULT_SOUND_THREAD_STACK_SIZE + + DEFAULT_DVD_THREAD_STACK_SIZE + + detail::AxVoiceManager::WORK_SIZE_MAX + + detail::VoiceManager::WORK_SIZE_MAX + + detail::ChannelManager::WORK_SIZE_MAX; + + static u8 defaultSoundSystemWork[defaultWorkSize] ALIGN_DECL(32); + + // OSRegisterVersion(NW4R_SND_Version_); + + SoundSystemParam param; + param.soundThreadPriority = soundThreadPriority; + param.dvdThreadPriority = dvdThreadPriority; + + // @bug This function ignores the specified buffer size + InitSoundSystem(param, defaultSoundSystemWork, + sizeof(defaultSoundSystemWork)); +} + u32 SoundSystem::GetRequiredMemSize(SoundSystemParam const ¶m) { // could have just used align assert? idk @@ -210,6 +231,20 @@ bool SoundSystem::IsInitializedSoundSystem() return sInitialized; } + +void SoundSystem::WaitForResetReady() { + if (!sInitialized) { + return; + } + + u32 start = OSGetTick(); + + while (!detail::AxManager::GetInstance().IsResetReady()) { + if (OS_TICKS_TO_SEC(OSGetTick() - start) > 0) { + break; + } + } +} // SoundSystem::WaitForResetReady ([R89JEL]:/bin/RVL/Debug/mainD.MAP:14493) DECOMP_FORCE("SoundSystem::WaitForResetReady is TIME OUT.\n"); -- cgit v1.2.3